This does the following:
authorStefan Reinauer <stepan@coresystems.de>
Sat, 27 Feb 2010 01:50:21 +0000 (01:50 +0000)
committerStefan Reinauer <stepan@openbios.org>
Sat, 27 Feb 2010 01:50:21 +0000 (01:50 +0000)
cd coreboot/src/southbridge
svn mv i82801ca i82801cx
svn mv i82801dbm i82801dx
svn mv i82801er i82801ex
svn copy i82801xx i82801bx
svn mv i82801xx i82801ax

Plus, fixing up the filenames in these directories and the romstage.c and
Kconfig files of the mainboards using those drivers.
Plus, switching the thomson ip1000 and rca rm4100 to the i82801dx driver.

There's a lot more to be done, like
- adding device IDs for the ICH3 and newer drivers that have been kept in
  i82801xx so far
- drop the additional parts support from the ax and bx drivers.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Joseph Smith <joe@settoplinux.org>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5167 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

215 files changed:
src/mainboard/asus/mew-am/Kconfig
src/mainboard/asus/mew-am/devicetree.cb
src/mainboard/asus/mew-am/romstage.c
src/mainboard/asus/mew-vm/Kconfig
src/mainboard/asus/mew-vm/devicetree.cb
src/mainboard/asus/mew-vm/romstage.c
src/mainboard/dell/s1850/Kconfig
src/mainboard/dell/s1850/devicetree.cb
src/mainboard/dell/s1850/romstage.c
src/mainboard/digitallogic/adl855pc/Kconfig
src/mainboard/digitallogic/adl855pc/devicetree.cb
src/mainboard/digitallogic/adl855pc/romstage.c
src/mainboard/hp/e_vectra_p2706t/Kconfig
src/mainboard/hp/e_vectra_p2706t/devicetree.cb
src/mainboard/hp/e_vectra_p2706t/romstage.c
src/mainboard/intel/jarrell/Kconfig
src/mainboard/intel/jarrell/devicetree.cb
src/mainboard/intel/jarrell/romstage.c
src/mainboard/intel/xe7501devkit/Kconfig
src/mainboard/intel/xe7501devkit/devicetree.cb
src/mainboard/intel/xe7501devkit/failover.c
src/mainboard/intel/xe7501devkit/reset.c
src/mainboard/intel/xe7501devkit/romstage.c
src/mainboard/mitac/6513wu/Kconfig
src/mainboard/mitac/6513wu/devicetree.cb
src/mainboard/mitac/6513wu/romstage.c
src/mainboard/msi/ms6178/Kconfig
src/mainboard/msi/ms6178/devicetree.cb
src/mainboard/msi/ms6178/romstage.c
src/mainboard/nec/powermate2000/Kconfig
src/mainboard/nec/powermate2000/devicetree.cb
src/mainboard/nec/powermate2000/romstage.c
src/mainboard/rca/rm4100/Kconfig
src/mainboard/rca/rm4100/devicetree.cb
src/mainboard/rca/rm4100/gpio.c
src/mainboard/rca/rm4100/romstage.c
src/mainboard/supermicro/x6dhe_g2/Kconfig
src/mainboard/supermicro/x6dhe_g2/devicetree.cb
src/mainboard/supermicro/x6dhe_g2/romstage.c
src/mainboard/supermicro/x6dhr_ig/Kconfig
src/mainboard/supermicro/x6dhr_ig/devicetree.cb
src/mainboard/supermicro/x6dhr_ig/romstage.c
src/mainboard/supermicro/x6dhr_ig2/Kconfig
src/mainboard/supermicro/x6dhr_ig2/devicetree.cb
src/mainboard/supermicro/x6dhr_ig2/romstage.c
src/mainboard/thomson/ip1000/Kconfig
src/mainboard/thomson/ip1000/devicetree.cb
src/mainboard/thomson/ip1000/gpio.c
src/mainboard/thomson/ip1000/romstage.c
src/mainboard/tyan/s2735/Kconfig
src/mainboard/tyan/s2735/devicetree.cb
src/mainboard/tyan/s2735/reset.c
src/mainboard/tyan/s2735/romstage.c
src/southbridge/intel/Kconfig
src/southbridge/intel/Makefile.inc
src/southbridge/intel/i82801ax/Kconfig [new file with mode: 0644]
src/southbridge/intel/i82801ax/Makefile.inc [new file with mode: 0644]
src/southbridge/intel/i82801ax/chip.h [new file with mode: 0644]
src/southbridge/intel/i82801ax/cmos_failover.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax.h [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_ac97.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_early_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_early_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_ide.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_nic.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_pci.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_reset.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_sata.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_smbus.h [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_usb.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_usb_ehci.c [new file with mode: 0644]
src/southbridge/intel/i82801ax/i82801ax_watchdog.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/Kconfig [new file with mode: 0644]
src/southbridge/intel/i82801bx/Makefile.inc [new file with mode: 0644]
src/southbridge/intel/i82801bx/chip.h [new file with mode: 0644]
src/southbridge/intel/i82801bx/cmos_failover.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx.h [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_ac97.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_early_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_early_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_ide.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_nic.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_pci.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_reset.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_sata.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_smbus.h [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_usb.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_usb_ehci.c [new file with mode: 0644]
src/southbridge/intel/i82801bx/i82801bx_watchdog.c [new file with mode: 0644]
src/southbridge/intel/i82801ca/Kconfig [deleted file]
src/southbridge/intel/i82801ca/Makefile.inc [deleted file]
src/southbridge/intel/i82801ca/chip.h [deleted file]
src/southbridge/intel/i82801ca/cmos_failover.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca.h [deleted file]
src/southbridge/intel/i82801ca/i82801ca_ac97.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_early_smbus.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_ide.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_lpc.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_nic.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_pci.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_reset.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_smbus.c [deleted file]
src/southbridge/intel/i82801ca/i82801ca_usb.c [deleted file]
src/southbridge/intel/i82801cx/Kconfig [new file with mode: 0644]
src/southbridge/intel/i82801cx/Makefile.inc [new file with mode: 0644]
src/southbridge/intel/i82801cx/chip.h [new file with mode: 0644]
src/southbridge/intel/i82801cx/cmos_failover.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx.h [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_ac97.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_early_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_ide.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_nic.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_pci.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_reset.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801cx/i82801cx_usb.c [new file with mode: 0644]
src/southbridge/intel/i82801dbm/Kconfig [deleted file]
src/southbridge/intel/i82801dbm/Makefile.inc [deleted file]
src/southbridge/intel/i82801dbm/chip.h [deleted file]
src/southbridge/intel/i82801dbm/cmos_failover.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm.h [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_ac97.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_early_smbus.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_ide.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_lpc.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_nic.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_pci.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_reset.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_sata.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_smbus.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_usb.c [deleted file]
src/southbridge/intel/i82801dbm/i82801dbm_usb2.c [deleted file]
src/southbridge/intel/i82801dx/Kconfig [new file with mode: 0644]
src/southbridge/intel/i82801dx/Makefile.inc [new file with mode: 0644]
src/southbridge/intel/i82801dx/chip.h [new file with mode: 0644]
src/southbridge/intel/i82801dx/cmos_failover.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx.h [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_ac97.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_early_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_ide.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_nic.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_pci.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_reset.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_sata.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_usb.c [new file with mode: 0644]
src/southbridge/intel/i82801dx/i82801dx_usb2.c [new file with mode: 0644]
src/southbridge/intel/i82801er/Kconfig [deleted file]
src/southbridge/intel/i82801er/Makefile.inc [deleted file]
src/southbridge/intel/i82801er/chip.h [deleted file]
src/southbridge/intel/i82801er/cmos_failover.c [deleted file]
src/southbridge/intel/i82801er/i82801er.c [deleted file]
src/southbridge/intel/i82801er/i82801er.h [deleted file]
src/southbridge/intel/i82801er/i82801er_ac97.c [deleted file]
src/southbridge/intel/i82801er/i82801er_early_smbus.c [deleted file]
src/southbridge/intel/i82801er/i82801er_ehci.c [deleted file]
src/southbridge/intel/i82801er/i82801er_ide.c [deleted file]
src/southbridge/intel/i82801er/i82801er_lpc.c [deleted file]
src/southbridge/intel/i82801er/i82801er_pci.c [deleted file]
src/southbridge/intel/i82801er/i82801er_reset.c [deleted file]
src/southbridge/intel/i82801er/i82801er_sata.c [deleted file]
src/southbridge/intel/i82801er/i82801er_smbus.c [deleted file]
src/southbridge/intel/i82801er/i82801er_smbus.h [deleted file]
src/southbridge/intel/i82801er/i82801er_uhci.c [deleted file]
src/southbridge/intel/i82801er/i82801er_watchdog.c [deleted file]
src/southbridge/intel/i82801ex/Kconfig [new file with mode: 0644]
src/southbridge/intel/i82801ex/Makefile.inc [new file with mode: 0644]
src/southbridge/intel/i82801ex/chip.h [new file with mode: 0644]
src/southbridge/intel/i82801ex/cmos_failover.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex.h [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_ac97.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_early_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_ehci.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_ide.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_lpc.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_pci.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_reset.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_sata.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_smbus.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_smbus.h [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_uhci.c [new file with mode: 0644]
src/southbridge/intel/i82801ex/i82801ex_watchdog.c [new file with mode: 0644]
src/southbridge/intel/i82801xx/Kconfig [deleted file]
src/southbridge/intel/i82801xx/Makefile.inc [deleted file]
src/southbridge/intel/i82801xx/chip.h [deleted file]
src/southbridge/intel/i82801xx/cmos_failover.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx.h [deleted file]
src/southbridge/intel/i82801xx/i82801xx_ac97.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_early_lpc.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_early_smbus.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_ide.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_lpc.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_nic.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_pci.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_reset.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_sata.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_smbus.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_smbus.h [deleted file]
src/southbridge/intel/i82801xx/i82801xx_usb.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_usb_ehci.c [deleted file]
src/southbridge/intel/i82801xx/i82801xx_watchdog.c [deleted file]

index 7f16c5b6beabc75847d737c9f1a53b92dd11bc10..37317815ea9dc3ca46041654992a55087529b297 100644 (file)
@@ -23,7 +23,7 @@ config BOARD_ASUS_MEW_AM
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_SMSC_SMSCSUPERIO
        select ROMCC
        select HAVE_PIRQ_TABLE
index 2ca0e68cdac48112215d726ee8aea23f746b04c4..016f6dbc512fe6e566999a607609067c98ac08a9 100644 (file)
@@ -7,7 +7,7 @@ chip northbridge/intel/i82810           # Northbridge
   device pci_domain 0 on               # PCI domain
     device pci 0.0 on end              # Graphics Memory Controller Hub (GMCH)
     device pci 1.0 on end              # Chipset Graphics Controller (CGC)
-    chip southbridge/intel/i82801xx    # Southbridge
+    chip southbridge/intel/i82801ax    # Southbridge
       register "ide0_enable" = "1"
       register "ide1_enable" = "1"
 
index a7f74c42f4098c528f75acb8d0be54c0ef3f6d12..8751e0ec288a949de63f6a13a5d7aaea9932ca7d 100644 (file)
@@ -31,7 +31,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "northbridge/intel/i82810/raminit.h"
 #include "lib/debug.c"
 #include "pc80/udelay_io.c"
index 616fb4bdde8b108e073612ce871ee61c205faeac..f5cefd0df89b3ec04cdeca4cde26a7a0570c5699 100644 (file)
@@ -23,7 +23,7 @@ config BOARD_ASUS_MEW_VM
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_SMSC_LPC47B272
        select ROMCC
        select HAVE_PIRQ_TABLE
index 0dc4b6f4688e73d6e9d7332ab9d6ef8a4bf8299a..a5415a2bfe5d6bf20e02a34d4561cabb2a4e95a9 100644 (file)
@@ -4,7 +4,7 @@ chip northbridge/intel/i82810
                device pci 1.0 on # Onboard Video
                        #       device pci 1.0 on end
                end
-               chip southbridge/intel/i82801xx # Southbridge
+               chip southbridge/intel/i82801ax # Southbridge
                        register "ide0_enable" = "1"
                        register "ide1_enable" = "1"
 
index d9473a5880bfe0bab986ab9df85933fb72c6b55c..703cd87de5a0e755794d51f3b8bfc3f527bd0f36 100644 (file)
@@ -38,7 +38,7 @@
 
 #define SERIAL_DEV PNP_DEV(0x2e, LPC47B272_SP1)
 
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "lib/debug.c"
 #include "pc80/udelay_io.c"
 #include "lib/delay.c"
index 3f14662be46d4ccf85b5f285b2c9f827bfe769fc..aeb14a008a509f1030a542480350aac9dbdc8d88 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_DELL_S1850
        select ARCH_X86
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7520
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SOUTHBRIDGE_INTEL_PXHD
        select SUPERIO_NSC_PC8374
        select ROMCC
index 4e93a3aefb2f27288932b714889f15dd4729b81c..ab95e54a7b83b8fe62abb9c45cd968da317ddc26 100644 (file)
@@ -1,6 +1,6 @@
 chip northbridge/intel/e7520 # mch
        device pci_domain 0 on 
-               chip southbridge/intel/i82801er # i82801er
+               chip southbridge/intel/i82801ex # i82801er
                        # USB ports
                        device pci 1d.0 on end
                        device pci 1d.1 on end
index 5f62ce80a8450514db26717b85c44902abd45022..952c37c1cf42d78b78e2c41ff3977bebde80df5e 100644 (file)
@@ -12,7 +12,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7520/raminit.h"
 #include "superio/nsc/pc8374/pc8374_early_init.c"
 #include "cpu/x86/lapic/boot_cpu.c"
index fd109e9d64d67d55cf6e670389f37637e4f60475..58b9f6f0344b41000a4d9e63ffb9445f7acefe27 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_DIGITALLOGIC_ADL855PC
        select ARCH_X86
        select CPU_INTEL_SOCKET_MPGA479M
        select NORTHBRIDGE_INTEL_I855
-       select SOUTHBRIDGE_INTEL_I82801DBM
+       select SOUTHBRIDGE_INTEL_I82801DX
        select SUPERIO_WINBOND_W83627HF
        select ROMCC
        select HAVE_PIRQ_TABLE
index 0f600ac8f178d25785b1203d970665bbfefc87ae..6846b4e59c1d5fcd3b5b16cc7096f606f86ffd35 100644 (file)
@@ -2,7 +2,7 @@ chip northbridge/intel/i855
        device pci_domain 0 on 
                device pci 0.0 on end
                device pci 1.0 on end
-               chip southbridge/intel/i82801dbm
+               chip southbridge/intel/i82801dx
 #                      pci 11.0 on end
 #                      pci 11.1 on end
 #                      pci 11.2 on end
index 16d9195d3887d3dc9c2758fa8477ed227ee28ace..890387605704b47de0fb6b1688af662a9b5e0e19 100644 (file)
@@ -16,7 +16,8 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801dbm/i82801dbm_early_smbus.c"
+#include "southbridge/intel/i82801dx/i82801dx.h"
+#include "southbridge/intel/i82801dx/i82801dx_early_smbus.c"
 #include "northbridge/intel/i855/raminit.h"
 
 #if 0
index 676d3eb5d8cd5ab88cc49b97edbb4755a73b604b..755b3ac9042b82e72822aba1d7664b146d165891 100644 (file)
@@ -26,7 +26,7 @@ config BOARD_HP_E_VECTRA_P2706T
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_NSC_PC87360
        select ROMCC
        select HAVE_PIRQ_TABLE
index 82209d4317e1fb2875cf3f2b761e39aa796b727f..7ea1f299e798408a92122bae5de1ef876386e89f 100644 (file)
@@ -8,7 +8,7 @@ chip northbridge/intel/i82810                   # Northbridge
   device pci_domain 0 on
     device pci 0.0 on end                      # Host bridge
     device pci 1.0 on end                      # Onboard VGA
-    chip southbridge/intel/i82801xx            # Southbridge
+    chip southbridge/intel/i82801ax            # Southbridge
       register "ide0_enable" = "1"
       register "ide1_enable" = "1"
 
index 50d8c447b460813e3e376dbf5ec6098bbcd17752..f2c643c8540fff8c898e2446986ce86129041cff 100644 (file)
@@ -37,7 +37,7 @@
 #include "northbridge/intel/i82810/raminit.h"
 #include "cpu/x86/mtrr/earlymtrr.c"
 #include "cpu/x86/bist.h"
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "pc80/udelay_io.c"
 #include "lib/debug.c"
 #include "northbridge/intel/i82810/raminit.c"
index 7a17ea7782435f6967c4de62651d2d98df730a02..fc70befafad5da68ee41e85d859825544438b9c6 100644 (file)
@@ -4,7 +4,7 @@ config BOARD_INTEL_JARRELL
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7520
        select SOUTHBRIDGE_INTEL_PXHD
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SUPERIO_NSC_PC87427
        select ROMCC
        select HAVE_PIRQ_TABLE
index e4cdbdeacbbf5f3ddd72dc88f78537459d7efbd8..32f70e3e857e09d2afceded0002cff9782ea3c88 100644 (file)
@@ -17,7 +17,7 @@ chip northbridge/intel/e7520
                        end
                end
                device pci 06.0 on end
-               chip southbridge/intel/i82801er # i82801er
+               chip southbridge/intel/i82801ex # i82801er
                        device pci 1d.0 on end
                        device pci 1d.1 on end
                        device pci 1d.2 on end
index 462bd8e25d8f50202c59b5e3cca1fabd0b015ce9..d7b1bf40c7069aaf2e6562dcaf44a8e67f24d3ad 100644 (file)
@@ -12,7 +12,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7520/raminit.h"
 #include "superio/nsc/pc87427/pc87427.h"
 #include "cpu/x86/lapic/boot_cpu.c"
index 72c1d94fb2f350c3b44a967c697e8d3bb89dfc72..d2a9f4779f50f0056cc594cd134fdd43fa546c31 100644 (file)
@@ -4,7 +4,7 @@ config BOARD_INTEL_XE7501DEVKIT
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7501
        select SOUTHBRIDGE_INTEL_I82870
-       select SOUTHBRIDGE_INTEL_I82801CA
+       select SOUTHBRIDGE_INTEL_I82801CX
        select SUPERIO_SMSC_LPC47B272
        select ROMCC
        select HAVE_PIRQ_TABLE
index 00ed4eca84b37020d6b757353fdae83ccb485f08..efa0d8821636793538506dee14c75ccefc39c758 100644 (file)
@@ -20,7 +20,7 @@ chip northbridge/intel/e7501
                        end
                end
                device pci 6.0 on end # E7501 Power management registers? (undocumented)
-               chip southbridge/intel/i82801ca
+               chip southbridge/intel/i82801cx
                        device pci 1d.0 off end # USB (might not work, Southbridge code needs looking at)
                        device pci 1d.1 off end # USB (not populated)
                        device pci 1d.2 off end # USB (not populated)
index 7aa9e405ed554c958113fccf370ebb9bbc4395e8..9daf3b27d6912cff17c63b192c7fba3b63d419f9 100644 (file)
@@ -7,7 +7,7 @@
 #include <arch/romcc_io.h>
 #include <cpu/x86/lapic.h>
 #include "pc80/mc146818rtc_early.c"
-#include "southbridge/intel/i82801ca/cmos_failover.c"
+#include "southbridge/intel/i82801cx/cmos_failover.c"
 #include "cpu/x86/lapic/boot_cpu.c"
 #include "northbridge/intel/e7501/reset_test.c"
 
index 8feaac64e50dff9f998265627ad56c471d292b7d..7c8a729f5eab5a5cb91ababc56e77123000b06cd 100644 (file)
@@ -1,6 +1,6 @@
-void i82801ca_hard_reset(void);
+void i82801cx_hard_reset(void);
 
 void hard_reset(void)
 {
-       i82801ca_hard_reset();
+       i82801cx_hard_reset();
 }
index 7269fa8d43a9ed59c4e91579d584b57032c010fb..0bedaf94316086db571be575ebe1416ddcdcc652 100644 (file)
@@ -14,7 +14,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801ca/i82801ca_early_smbus.c"
+#include "southbridge/intel/i82801cx/i82801cx_early_smbus.c"
 #include "northbridge/intel/e7501/raminit.h"
 #include "cpu/x86/lapic/boot_cpu.c"
 #include "northbridge/intel/e7501/debug.c"
index 20559b24b0957c3c59c76ea28f51bcd893a769b4..64937ce1c545000c5a808995080813c5aeaec489 100644 (file)
@@ -23,7 +23,7 @@ config BOARD_MITAC_6513WU
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_SMSC_SMSCSUPERIO
        select ROMCC
        select HAVE_PIRQ_TABLE
index 0369775c0777b07ea95d6c6d3339901c47aaf644..3cba778e10144fed30ac34a4ce610e9c936779bc 100644 (file)
@@ -27,7 +27,7 @@ chip northbridge/intel/i82810           # Northbridge
   device pci_domain 0 on                # PCI domain
     device pci 0.0 on end               # Graphics Memory Controller Hub (GMCH)
     device pci 1.0 on end
-    chip southbridge/intel/i82801xx     # Southbridge
+    chip southbridge/intel/i82801ax     # Southbridge
       register "pirqa_routing" = "0x03"
       register "pirqb_routing" = "0x05"
       register "pirqc_routing" = "0x09"
index 6222ea87210eb7c740a8500fa6401d1be3f33ec0..daa2e9660c9ada31eefb41e7ca8a376f4a4d0f0e 100644 (file)
@@ -31,7 +31,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "northbridge/intel/i82810/raminit.h"
 #include "lib/debug.c"
 #include "pc80/udelay_io.c"
index 16662da312b4b3fcb5b82f8a997881d46a9527c6..a6af3260d0e8bc1fb4f63a21e042207e83572032 100644 (file)
@@ -23,7 +23,7 @@ config BOARD_MSI_MS_6178
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_WINBOND_W83627HF
        select ROMCC
        select HAVE_PIRQ_TABLE
index baa0e040b830c9e8f65f5dd8d950494354281dc5..48639577147453f7ca24d65a50556f4c59e2b5dc 100644 (file)
@@ -27,7 +27,7 @@ chip northbridge/intel/i82810                 # Northbridge
   device pci_domain 0 on
     device pci 0.0 on end                      # Host bridge
     device pci 1.0 on end                      # Onboard VGA
-    chip southbridge/intel/i82801xx            # Southbridge
+    chip southbridge/intel/i82801ax            # Southbridge
       register "ide0_enable" = "1"
       register "ide1_enable" = "1"
 
index a320dde7633d1be411d218faf1c1c4e7883a1e5e..976d24a56cb24656da8aa8b1d4c1f90fabee05de 100644 (file)
@@ -35,7 +35,7 @@
 #include "northbridge/intel/i82810/raminit.h"
 #include "cpu/x86/mtrr/earlymtrr.c"
 #include "cpu/x86/bist.h"
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "pc80/udelay_io.c"
 #include "lib/debug.c"
 #include "northbridge/intel/i82810/raminit.c"
index fa3532d028a4d8bea55d76aa90365206d6c01bc5..7b818b45e1168ec2cb9c37cabb07e1ca67799872 100644 (file)
@@ -23,7 +23,7 @@ config BOARD_NEC_POWERMATE_2000
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82810
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801AX
        select SUPERIO_SMSC_SMSCSUPERIO
        select ROMCC
        select HAVE_PIRQ_TABLE
index 0cb7e328b5047364e959523758f38b662d9518ca..52cae5823ccc97f839c1aa25fc59c6ff7037479e 100644 (file)
@@ -7,7 +7,7 @@ chip northbridge/intel/i82810                   # Northbridge
   device pci_domain 0 on
     device pci 0.0 on end                      # Host bridge
     device pci 1.0 off end                     # Onboard video
-    chip southbridge/intel/i82801xx            # Southbridge
+    chip southbridge/intel/i82801ax            # Southbridge
       register "ide0_enable" = "1"
       register "ide1_enable" = "1"
 
index 701e312967b671cf962f8150ed2fe56c888eb13e..c923f9943a8816e6b052a476fe3f321086dfc03b 100644 (file)
@@ -35,7 +35,7 @@
 #include "northbridge/intel/i82810/raminit.h"
 #include "cpu/x86/mtrr/earlymtrr.c"
 #include "cpu/x86/bist.h"
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801ax/i82801ax_early_smbus.c"
 #include "pc80/udelay_io.c"
 #include "northbridge/intel/i82810/raminit.c"
 
index 1be2a752dc4496d92276723a484448fe9536a77a..cdca002ea3e68b8c486b8b3abd013c233525bbd5 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_RCA_RM4100
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82830
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801DX
        select SUPERIO_SMSC_SMSCSUPERIO
        select ROMCC
        select HAVE_PIRQ_TABLE
index 1844932114dadb9b37767f640721901b36605773..2b04ad7d3a0403f06b7e02f9a6cb7bb15ea95885 100644 (file)
@@ -2,7 +2,7 @@ chip northbridge/intel/i82830           # Northbridge
   device pci_domain 0 on               # PCI domain
     device pci 0.0 on end              # Host bridge
     device pci 2.0 on end              # VGA (Intel 82830 CGC)
-    chip southbridge/intel/i82801xx    # Southbridge
+    chip southbridge/intel/i82801dx    # Southbridge
       register "pirqa_routing" = "0x05"
       register "pirqb_routing" = "0x06"
       register "pirqc_routing" = "0x07"
index d51bc90e789977670b8a551b1f70b9e461d32ac1..a27b7bb327377b77a55120f2eaae29131a96c3b0 100644 (file)
@@ -34,8 +34,8 @@ static void mb_gpio_init(void)
        dev = PCI_DEV(0x0, 0x1f, 0x0);
 
        /* Set the value for GPIO base address register and enable GPIO. */
-       pci_write_config32(dev, GPIO_BASE_ICH0_5, (ICH_IO_BASE_ADDR | 1));
-       pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
+       pci_write_config32(dev, GPIO_BASE, (ICH_IO_BASE_ADDR | 1));
+       pci_write_config8(dev, GPIO_CNTL, 0x10);
 
        /* Set GPIO23 to high, this enables the LAN controller. */
        udelay(10);
index 2f3892e3a0e337a7403bc298b742e1d53f5c6ea4..cf7464442db358d878179e47ef201ce9fa2f4c23 100644 (file)
@@ -35,8 +35,8 @@
 #include "superio/smsc/smscsuperio/smscsuperio_early_serial.c"
 #include "northbridge/intel/i82830/raminit.h"
 #include "northbridge/intel/i82830/memory_initialized.c"
-#include "southbridge/intel/i82801xx/i82801xx.h"
-#include "southbridge/intel/i82801xx/i82801xx_reset.c"
+#include "southbridge/intel/i82801dx/i82801dx.h"
+#include "southbridge/intel/i82801dx/i82801dx_reset.c"
 #include "cpu/x86/mtrr/earlymtrr.c"
 #include "cpu/x86/bist.h"
 #include "spd_table.h"
@@ -44,7 +44,7 @@
 
 #define SERIAL_DEV PNP_DEV(0x2e, SMSCSUPERIO_SP1)
 
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801dx/i82801dx_early_smbus.c"
 
 /**
  * The onboard 64MB PC133 memory does not have a SPD EEPROM so the
@@ -127,4 +127,4 @@ static void main(unsigned long bist)
        /* Check RAM. */
        /* ram_check(0, 640 * 1024); */
        /* ram_check(64512 * 1024, 65536 * 1024); */
-}
\ No newline at end of file
+}
index eb3330c02320d94757d98f0b4344c3913a2c492f..a456abea8a18b12d9174fbb2c8fede8d333249ca 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_SUPERMICRO_X6DHE_G2
        select ARCH_X86
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7520
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SOUTHBRIDGE_INTEL_PXHD
        select SUPERIO_NSC_PC87427
        select ROMCC
index 4bb720707c224f68225b24031881801150c96ddf..e621594b937b41806ada5c2bf5969de455a018c5 100644 (file)
@@ -6,7 +6,7 @@ chip northbridge/intel/e7520  # MCH
                device pnp 00.3 off end
        end
        device pci_domain 0 on
-               chip southbridge/intel/i82801er # ICH5R 
+               chip southbridge/intel/i82801ex # ICH5R 
                        register "pirq_a_d" = "0x0b070a05"
                        register "pirq_e_h" = "0x0a808080"
 
index 4e9c1e270b7092771509ca4e3a7cda871efc10b5..f38f4e9b07ace97c4b6b664094b7b30dd3d570f5 100644 (file)
@@ -12,7 +12,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7520/raminit.h"
 #include "superio/nsc/pc87427/pc87427.h"
 #include "cpu/x86/lapic/boot_cpu.c"
index 759e6d14ba7abba7c3456ca034dfd86dc9a36327..56653adc9b80c2327a4af371a70eb7862fa67b6d 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_SUPERMICRO_X6DHR_IG
        select ARCH_X86
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7520
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SOUTHBRIDGE_INTEL_PXHD
        select SUPERIO_WINBOND_W83627HF
        select ROMCC
index 8a82ed7c40af990de3c1afe397f3e9471701670e..921c54fff5b5d74c1e682e605448a8de40b34cf3 100644 (file)
@@ -1,6 +1,6 @@
 chip northbridge/intel/e7520 # mch
        device pci_domain 0 on 
-               chip southbridge/intel/i82801er # i82801er
+               chip southbridge/intel/i82801ex # i82801er
                        # USB ports
                        device pci 1d.0 on end
                        device pci 1d.1 on end
index 314cc703250274dca518bd864788c3d6ab48d274..0fd77d3a560ba730823858293cff90a42144101b 100644 (file)
@@ -12,7 +12,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7520/raminit.h"
 #include "superio/winbond/w83627hf/w83627hf.h"
 #include "cpu/x86/lapic/boot_cpu.c"
index e25f8bf7d0fde2ac2f94a715e982acf0542594e4..126739be10f7193e88d8fc046316f1b9596d22d1 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_SUPERMICRO_X6DHR_IG2
        select ARCH_X86
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7520
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SOUTHBRIDGE_INTEL_PXHD
        select SUPERIO_WINBOND_W83627HF
        select ROMCC
index ab56509fd9ea64996b952ac3987d79a1b3c4c6bf..318d492b9fff4a7ec997ecb2a2fd1c7223f317e8 100644 (file)
@@ -1,6 +1,6 @@
 chip northbridge/intel/e7520 # mch
        device pci_domain 0 on 
-               chip southbridge/intel/i82801er # i82801er
+               chip southbridge/intel/i82801ex # i82801er
                        # USB ports
                        device pci 1d.0 on end
                        device pci 1d.1 on end
index 3cb41ad037460cedf5efdcf8db9bf0e55b85cd8f..7a9b696198fdec86eab0324a641d22c3ad8b3309 100644 (file)
@@ -12,7 +12,7 @@
 #include "pc80/serial.c"
 #include "arch/i386/lib/console.c"
 #include "lib/ramtest.c"
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7520/raminit.h"
 #include "superio/winbond/w83627hf/w83627hf.h"
 #include "cpu/x86/lapic/boot_cpu.c"
index 6a87d0cfc85b8d4d75c997e8152a5d2b50262e3a..b78a20e388b6306b297b1314f77e44e1d00259f6 100644 (file)
@@ -3,7 +3,7 @@ config BOARD_THOMSON_IP1000
        select ARCH_X86
        select CPU_INTEL_SOCKET_PGA370
        select NORTHBRIDGE_INTEL_I82830
-       select SOUTHBRIDGE_INTEL_I82801XX
+       select SOUTHBRIDGE_INTEL_I82801DX
        select SUPERIO_SMSC_SMSCSUPERIO
        select ROMCC
        select HAVE_PIRQ_TABLE
@@ -28,4 +28,4 @@ config HAVE_OPTION_TABLE
 config IRQ_SLOT_COUNT
        int
        default 7
-       depends on BOARD_THOMSON_IP1000
\ No newline at end of file
+       depends on BOARD_THOMSON_IP1000
index 7f5c42a8cf52207042df11920155a51aa99216ca..f38c1c3e67854bbcb54e6bf5bf814a13f9e16e8b 100644 (file)
@@ -2,7 +2,7 @@ chip northbridge/intel/i82830           # Northbridge
   device pci_domain 0 on               # PCI domain
     device pci 0.0 on end              # Host bridge
     device pci 2.0 on end              # VGA (Intel 82830 CGC)
-    chip southbridge/intel/i82801xx    # Southbridge
+    chip southbridge/intel/i82801dx    # Southbridge
       register "pirqa_routing" = "0x05"
       register "pirqb_routing" = "0x06"
       register "pirqc_routing" = "0x07"
index ae2cd8eabfc68a4742d793d71d730ccb40d05f8b..6a69bb539d06aefd6e9254b468fbcd38692afc79 100644 (file)
@@ -34,8 +34,8 @@ static void mb_gpio_init(void)
        dev = PCI_DEV(0x0, 0x1f, 0x0);
 
        /* Set the value for GPIO base address register and enable GPIO. */
-       pci_write_config32(dev, GPIO_BASE_ICH0_5, (ICH_IO_BASE_ADDR | 1));
-       pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
+       pci_write_config32(dev, GPIO_BASE, (ICH_IO_BASE_ADDR | 1));
+       pci_write_config8(dev, GPIO_CNTL, 0x10);
 
        /* Set GPIO23 to high, this enables the LAN controller. */
        udelay(10);
index 2f3892e3a0e337a7403bc298b742e1d53f5c6ea4..cf7464442db358d878179e47ef201ce9fa2f4c23 100644 (file)
@@ -35,8 +35,8 @@
 #include "superio/smsc/smscsuperio/smscsuperio_early_serial.c"
 #include "northbridge/intel/i82830/raminit.h"
 #include "northbridge/intel/i82830/memory_initialized.c"
-#include "southbridge/intel/i82801xx/i82801xx.h"
-#include "southbridge/intel/i82801xx/i82801xx_reset.c"
+#include "southbridge/intel/i82801dx/i82801dx.h"
+#include "southbridge/intel/i82801dx/i82801dx_reset.c"
 #include "cpu/x86/mtrr/earlymtrr.c"
 #include "cpu/x86/bist.h"
 #include "spd_table.h"
@@ -44,7 +44,7 @@
 
 #define SERIAL_DEV PNP_DEV(0x2e, SMSCSUPERIO_SP1)
 
-#include "southbridge/intel/i82801xx/i82801xx_early_smbus.c"
+#include "southbridge/intel/i82801dx/i82801dx_early_smbus.c"
 
 /**
  * The onboard 64MB PC133 memory does not have a SPD EEPROM so the
@@ -127,4 +127,4 @@ static void main(unsigned long bist)
        /* Check RAM. */
        /* ram_check(0, 640 * 1024); */
        /* ram_check(64512 * 1024, 65536 * 1024); */
-}
\ No newline at end of file
+}
index 8d516fe66040c2f431dd54e389d8e5e4a2e038d1..0c3f8a573d03fe110b2f81fc327a2fefb03b67a6 100644 (file)
@@ -4,7 +4,7 @@ config BOARD_TYAN_S2735
        select CPU_INTEL_SOCKET_MPGA604
        select NORTHBRIDGE_INTEL_E7501
        select SOUTHBRIDGE_INTEL_I82870
-       select SOUTHBRIDGE_INTEL_I82801ER
+       select SOUTHBRIDGE_INTEL_I82801EX
        select SUPERIO_WINBOND_W83627HF
        select HAVE_PIRQ_TABLE
        select HAVE_MP_TABLE
index 0fdd57814ac9d22f95a7e1d9c1dac72c5fcd3d46..8ad5e0ecac82869cbdd9a688450999232d68d75d 100644 (file)
@@ -14,7 +14,7 @@ chip northbridge/intel/e7501
                        end
                end
                device pci 6.0 on end
-               chip southbridge/intel/i82801er
+               chip southbridge/intel/i82801ex
                        device pci 1d.0 on end
                        device pci 1d.1 on end
                        device pci 1d.2 on end
index 371920dca259654cf170f5cacb7962d4e1bed4fa..2601faa6762699fbe0d5a6ffb1b2da20019a10f7 100644 (file)
@@ -1,7 +1,7 @@
-void i82801er_hard_reset(void);
+void i82801ex_hard_reset(void);
 
 /* FIXME: There's another hard_reset() in romstage.c. Why? */
 void hard_reset(void)
 {
-       i82801er_hard_reset();
+       i82801ex_hard_reset();
 }
index 99a38a9fb33badd9e7851290893c2e732b34bc67..5e2678a047b70701adbbdae296156b1cc9c13e0b 100644 (file)
@@ -25,7 +25,7 @@ static void post_code(uint8_t value) {
 }
 #endif
 
-#include "southbridge/intel/i82801er/i82801er_early_smbus.c"
+#include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
 #include "northbridge/intel/e7501/raminit.h"
 
 #include "cpu/x86/lapic/boot_cpu.c"
@@ -82,7 +82,7 @@ static inline int spd_read_byte(unsigned device, unsigned address)
 
 #if CONFIG_USE_FALLBACK_IMAGE == 1
 
-#include "southbridge/intel/i82801er/cmos_failover.c"
+#include "southbridge/intel/i82801ex/cmos_failover.c"
 
 void real_main(unsigned long bist);
 
index 92be28623dd1f1393931c67be89047cd22529679..61cd79696bc5623fe996b75928da5c0b5d3cadb6 100644 (file)
@@ -1,10 +1,11 @@
 source src/southbridge/intel/esb6300/Kconfig
 source src/southbridge/intel/i3100/Kconfig
 source src/southbridge/intel/i82371eb/Kconfig
-source src/southbridge/intel/i82801ca/Kconfig
-source src/southbridge/intel/i82801dbm/Kconfig
-source src/southbridge/intel/i82801er/Kconfig
+source src/southbridge/intel/i82801ax/Kconfig
+source src/southbridge/intel/i82801bx/Kconfig
+source src/southbridge/intel/i82801cx/Kconfig
+source src/southbridge/intel/i82801dx/Kconfig
+source src/southbridge/intel/i82801ex/Kconfig
 source src/southbridge/intel/i82801gx/Kconfig
-source src/southbridge/intel/i82801xx/Kconfig
 source src/southbridge/intel/i82870/Kconfig
 source src/southbridge/intel/pxhd/Kconfig
index e53450f95fa769385e1d942e78f079849ab8c519..12ba7108bafb3471600087d7e77a6a0e602467f1 100644 (file)
@@ -1,11 +1,12 @@
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_ESB6300) += esb6300
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I3100) += i3100
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82371EB) += i82371eb
-subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801CA) += i82801ca
-subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801DBM) += i82801dbm
-subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801ER) += i82801er
+subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801AX) += i82801ax
+subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801BX) += i82801bx
+subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801CX) += i82801cx
+subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801DX) += i82801dx
+subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801EX) += i82801ex
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801GX) += i82801gx
-subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82801XX) += i82801xx
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_I82870) += i82870
 subdirs-$(CONFIG_SOUTHBRIDGE_INTEL_PXHD) += pxhd
 
diff --git a/src/southbridge/intel/i82801ax/Kconfig b/src/southbridge/intel/i82801ax/Kconfig
new file mode 100644 (file)
index 0000000..25e2c3a
--- /dev/null
@@ -0,0 +1,23 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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 SOUTHBRIDGE_INTEL_I82801AX
+       bool
+
diff --git a/src/southbridge/intel/i82801ax/Makefile.inc b/src/southbridge/intel/i82801ax/Makefile.inc
new file mode 100644 (file)
index 0000000..3e66f04
--- /dev/null
@@ -0,0 +1,38 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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
+##
+
+driver-y += i82801ax.o
+driver-y += i82801ax_ac97.o
+driver-y += i82801ax_ide.o
+driver-y += i82801ax_lpc.o
+driver-y += i82801ax_nic.o
+driver-y += i82801ax_pci.o
+driver-y += i82801ax_sata.o
+# driver-y += i82801ax_smbus.o
+driver-y += i82801ax_usb.o
+driver-y += i82801ax_usb_ehci.o
+
+obj-y += i82801ax_reset.o
+obj-y += i82801ax_watchdog.o
+
+# TODO: What about cmos_failover.c?
+
+# TODO: Fix and enable i82801ax_smbus.o later.
+
diff --git a/src/southbridge/intel/i82801ax/chip.h b/src/southbridge/intel/i82801ax/chip.h
new file mode 100644 (file)
index 0000000..90bbfcb
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey_osgood@verizon.net>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/*
+ * The i82801ax code currently supports:
+ *  - 82801AA
+ *  - 82801AB
+ *  - 82801BA
+ *  - 82801CA
+ *  - 82801DB
+ *  - 82801DBM
+ *  - 82801EB
+ *  - 82801ER
+ *
+ * This code should NOT be used for ICH6 and later versions.
+ */
+
+#ifndef SOUTHBRIDGE_INTEL_I82801AX_CHIP_H
+#define SOUTHBRIDGE_INTEL_I82801AX_CHIP_H
+
+struct southbridge_intel_i82801ax_config {
+       /**
+        * Interrupt Routing configuration
+        * If bit7 is 1, the interrupt is disabled.
+        */
+       uint8_t pirqa_routing;
+       uint8_t pirqb_routing;
+       uint8_t pirqc_routing;
+       uint8_t pirqd_routing;
+       uint8_t pirqe_routing;
+       uint8_t pirqf_routing;
+       uint8_t pirqg_routing;
+       uint8_t pirqh_routing;
+
+       uint8_t ide0_enable;
+       uint8_t ide1_enable;
+};
+
+extern struct chip_operations southbridge_intel_i82801ax_ops;
+
+#endif
diff --git a/src/southbridge/intel/i82801ax/cmos_failover.c b/src/southbridge/intel/i82801ax/cmos_failover.c
new file mode 100644 (file)
index 0000000..a770005
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 "i82801ax.h"
+
+static void check_cmos_failed(void)
+{
+       uint8_t byte;
+       byte = pci_read_config8(PCI_DEV(0, 0x1f, 0), GEN_PMCON_3);
+       if (byte & RTC_FAILED) {
+               //clear bit 1 and bit 2
+               byte = cmos_read(RTC_BOOT_BYTE);
+               byte &= 0x0c;
+               byte |= CONFIG_MAX_REBOOT_CNT << 4;
+               cmos_write(byte, RTC_BOOT_BYTE);
+       }
+}
diff --git a/src/southbridge/intel/i82801ax/i82801ax.c b/src/southbridge/intel/i82801ax/i82801ax.c
new file mode 100644 (file)
index 0000000..ea4cda6
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Digital Design Corporation
+ * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include "i82801ax.h"
+
+void i82801ax_enable(device_t dev)
+{
+       unsigned int index = 0;
+       uint16_t cur_disable_mask, new_disable_mask;
+
+       /* All 82801xx devices should be on bus 0. */
+       unsigned int devfn = PCI_DEVFN(0x1f, 0);        // LPC
+       device_t lpc_dev = dev_find_slot(0, devfn);     // 0
+       if (!lpc_dev)
+               return;
+
+       /* We're going to assume, perhaps incorrectly, that if a function
+        * exists it can be disabled. Workarounds for ICH variants that don't
+        * follow this should be done by checking the device ID.
+        */
+       if (PCI_SLOT(dev->path.pci.devfn) == 31) {
+               index = PCI_FUNC(dev->path.pci.devfn);
+       } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
+               index = 8 + PCI_FUNC(dev->path.pci.devfn);
+       }
+
+       /* Function 0 is a bit of an exception. */
+       if (index == 0) {
+               index = 14;
+       }
+
+       cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
+       new_disable_mask = cur_disable_mask & ~(1 << index); /* Enable it. */
+       if (!dev->enabled) {
+               new_disable_mask |= (1 << index); /* Disable it, if desired. */
+       }
+       if (new_disable_mask != cur_disable_mask) {
+               pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
+       }
+}
+
+struct chip_operations southbridge_intel_i82801ax_ops = {
+       CHIP_NAME("Intel ICH/ICH0 (82801AA/AB) Series Southbridge")
+       .enable_dev = i82801ax_enable,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax.h b/src/southbridge/intel/i82801ax/i82801ax.h
new file mode 100644 (file)
index 0000000..f9b4977
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 SOUTHBRIDGE_INTEL_I82801AX_I82801AX_H
+#define SOUTHBRIDGE_INTEL_I82801AX_I82801AX_H
+
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
+#include "chip.h"
+extern void i82801ax_enable(device_t dev);
+#endif
+
+#define PCI_DMA_CFG            0x90
+#define SERIRQ_CNTL            0x64
+#define GEN_CNTL               0xd0
+#define GEN_STS                        0xd4
+#define RTC_CONF               0xd8
+#define GEN_PMCON_3            0xa4
+
+#define PMBASE                 0x40
+#define PMBASE_ADDR            0x0400 /* ACPI Base Address Register */
+#define ACPI_CNTL              0x44
+#define BIOS_CNTL              0x4E
+#define GPIO_BASE_ICH0_5       0x58 /* LPC GPIO Base Addr. Reg. (ICH0-ICH5) */
+#define GPIO_BASE_ICH6_9       0x48 /* LPC GPIO Base Address Register (ICH6-ICH9) */
+#define GPIO_CNTL_ICH0_5       0x5C /* LPC GPIO Control Register (ICH0-ICH5) */
+#define GPIO_CNTL_ICH6_9       0x4C /* LPC GPIO Control Register (ICH6-ICH9) */
+
+#define PIRQA_ROUT             0x60
+#define PIRQB_ROUT             0x61
+#define PIRQC_ROUT             0x62
+#define PIRQD_ROUT             0x63
+#define PIRQE_ROUT             0x68
+#define PIRQF_ROUT             0x69
+#define PIRQG_ROUT             0x6A
+#define PIRQH_ROUT             0x6B
+
+#define FUNC_DIS               0xF2
+
+#define COM_DEC                        0xE0 /* LPC I/F Communication Port Decode Ranges (ICH0-ICH5) */
+#define LPC_IO_DEC             0x80 /* IO Decode Ranges Register (ICH6-ICH9) */
+#define LPC_EN_ICH0_5          0xE6 /* LPC IF Enables Register (ICH0-ICH5) */
+#define LPC_EN_ICH6_9          0x82 /* LPC IF Enables Register (ICH6-ICH9) */
+
+#define SBUS_NUM               0x19
+#define SUB_BUS_NUM            0x1A
+#define SMLT                   0x1B
+#define IOBASE                 0x1C
+#define IOLIM                  0x1D
+#define MEMBASE                        0x20
+#define MEMLIM                 0x22
+#define CNF                    0x50
+#define MTT                    0x70
+#define PCI_MAST_STS           0x82
+
+#define TCOBASE                        0x60 /* TCO Base Address Register */
+#define TCO1_CNT               0x08 /* TCO1 Control Register */
+
+/* GEN_PMCON_3 bits */
+#define RTC_BATTERY_DEAD       (1 << 2)
+#define RTC_POWER_FAILED       (1 << 1)
+#define SLEEP_AFTER_POWER_FAIL (1 << 0)
+
+/* PCI Configuration Space (D31:F1) */
+#define IDE_TIM_PRI            0x40    /* IDE timings, primary */
+#define IDE_TIM_SEC            0x42    /* IDE timings, secondary */
+
+/* IDE_TIM bits */
+#define IDE_DECODE_ENABLE      (1 << 15)
+
+/* PCI Configuration Space (D31:F3) */
+#define SMB_BASE               0x20
+#define HOSTC                  0x40
+
+/* HOSTC bits */
+#define I2C_EN                 (1 << 2)
+#define SMB_SMI_EN             (1 << 1)
+#define HST_EN                 (1 << 0)
+
+/* SMBus I/O bits.
+ * TODO: Does it matter where we put the SMBus IO base, as long as we keep
+ * consistent and don't interfere with anything else?
+ */
+/* #define SMBUS_IO_BASE 0x1000 */
+#define SMBUS_IO_BASE          0x0f00
+
+#define SMBHSTSTAT             0x0
+#define SMBHSTCTL              0x2
+#define SMBHSTCMD              0x3
+#define SMBXMITADD             0x4
+#define SMBHSTDAT0             0x5
+#define SMBHSTDAT1             0x6
+#define SMBBLKDAT              0x7
+#define SMBTRNSADD             0x9
+#define SMBSLVDATA             0xa
+#define SMLINK_PIN_CTL         0xe
+#define SMBUS_PIN_CTL          0xf
+
+#define SMBUS_TIMEOUT          (10 * 1000 * 100)
+
+/* HPET, if present */
+#define HPET_ADDR              0xfed0000
+
+#endif                         /* SOUTHBRIDGE_INTEL_I82801AX_I82801AX_H */
diff --git a/src/southbridge/intel/i82801ax/i82801ax_ac97.c b/src/southbridge/intel/i82801ax/i82801ax_ac97.c
new file mode 100644 (file)
index 0000000..7ef4142
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with AC97 audio/modem. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ax.h"
+
+static struct device_operations ac97_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = 0,
+       .enable                 = i82801ax_enable,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801aa_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_MODEM,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ab_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_MODEM,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ba_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_MODEM,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ca_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_MODEM,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801db_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_MODEM,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801eb_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_MODEM,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801fb_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_MODEM,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_early_lpc.c b/src/southbridge/intel/i82801ax/i82801ax_early_lpc.c
new file mode 100644 (file)
index 0000000..abcf9c6
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008 Joseph Smith <joe@settoplinux.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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
+ *
+ */
+
+static void i82801ax_halt_tco_timer(void)
+{
+       device_t dev;
+       uint16_t halt_tco_timer;
+
+       /* Set the LPC device statically. */
+       dev = PCI_DEV(0x0, 0x1f, 0x0);
+
+       /* Temporarily set ACPI base address (I/O space). */
+       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
+
+       /* Temporarily enable ACPI I/O. */
+       pci_write_config8(dev, ACPI_CNTL, 0x10);
+
+       /* Halt the TCO timer, preventing SMI and automatic reboot */
+       outw(inw(PMBASE_ADDR + TCOBASE + TCO1_CNT) | (1 << 11), PMBASE_ADDR + TCOBASE + TCO1_CNT);
+
+       /* Disable ACPI I/O. */
+       pci_write_config8(dev, ACPI_CNTL, 0x00);
+}
diff --git a/src/southbridge/intel/i82801ax/i82801ax_early_smbus.c b/src/southbridge/intel/i82801ax/i82801ax_early_smbus.c
new file mode 100644 (file)
index 0000000..d80c29c
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <device/pci_ids.h>
+#include "i82801ax.h"
+#include "i82801ax_smbus.h"
+
+static void enable_smbus(void)
+{
+       device_t dev;
+       uint16_t device_id;
+
+       /* Set the SMBus device statically. */
+       dev = PCI_DEV(0x0, 0x1f, 0x3);
+
+       /* Check to make sure we've got the right device. */
+       device_id = pci_read_config16(dev, 0x2);
+
+       /* Clear bits 7-4 (the only bits that vary between models). */
+       device_id &= 0xff0f;
+
+       if (device_id != 0x2403) {
+               die("Device not found, Corey probably screwed up!");
+       }
+
+       /* Set SMBus I/O base. */
+       pci_write_config32(dev, SMB_BASE,
+                          SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+
+       /* Set SMBus enable. */
+       pci_write_config8(dev, HOSTC, HST_EN);
+
+       /* Set SMBus I/O space enable. */
+       pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
+
+       /* Disable interrupt generation. */
+       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Clear any lingering errors, so transactions can run. */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       print_debug("SMBus controller enabled\r\n");
+}
+
+static inline int smbus_read_byte(unsigned device, unsigned address)
+{
+       return do_smbus_read_byte(device, address);
+}
+
+static void smbus_write_byte(unsigned device, unsigned address,
+                            unsigned char val)
+{
+       print_err("Unimplemented smbus_write_byte() called\r\n");
+       return;
+}
+
+static inline int smbus_write_block(unsigned device, unsigned length,
+                                   unsigned cmd, unsigned data1,
+                                   unsigned data2)
+{
+       return do_smbus_write_block(device, length, cmd, data1, data2);
+}
diff --git a/src/southbridge/intel/i82801ax/i82801ax_ide.c b/src/southbridge/intel/i82801ax/i82801ax_ide.c
new file mode 100644 (file)
index 0000000..c13fb4d
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ * Copyright (C) 2005 Digital Design Corporation
+ * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ax.h"
+
+typedef struct southbridge_intel_i82801ax_config config_t;
+
+static void ide_init(struct device *dev)
+{
+       /* Get the chip configuration */
+       config_t *config = dev->chip_info; 
+
+       /* TODO: Needs to be tested for compatibility with ICH5(R). */
+       /* Enable IDE devices so the Linux IDE driver will work. */
+       uint16_t ideTimingConfig;
+
+       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
+       ideTimingConfig &= ~IDE_DECODE_ENABLE;
+       if (!config || config->ide0_enable) {
+               /* Enable primary IDE interface. */
+               ideTimingConfig |= IDE_DECODE_ENABLE;
+               printk_debug("IDE0: Primary IDE interface is enabled\n");
+       } else {
+               printk_info("IDE0: Primary IDE interface is disabled\n");
+       }
+       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
+
+       ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
+       ideTimingConfig &= ~IDE_DECODE_ENABLE;
+       if (!config || config->ide1_enable) {
+               /* Enable secondary IDE interface. */
+               ideTimingConfig |= IDE_DECODE_ENABLE;
+               printk_debug("IDE1: Secondary IDE interface is enabled\n");
+       } else {
+               printk_info("IDE1: Secondary IDE interface is disabled\n");
+       }
+       pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
+}
+
+static struct device_operations ide_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = ide_init,
+       .scan_bus               = 0,
+       .enable                 = i82801ax_enable,
+};
+
+/* 82801AA */
+static const struct pci_driver i82801aa_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2411,
+};
+
+/* 82801AB */
+static const struct pci_driver i82801ab_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2421,
+};
+
+/* 82801BA */
+static const struct pci_driver i82801ba_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x244b,
+};
+
+/* 82801CA */
+static const struct pci_driver i82801ca_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x248b,
+};
+
+/* 82801DB */
+static const struct pci_driver i82801db_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cb,
+};
+
+/* 82801DBM */
+static const struct pci_driver i82801dbm_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24ca,
+};
+
+/* 82801EB & 82801ER */
+static const struct pci_driver i82801ex_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24db,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_lpc.c b/src/southbridge/intel/i82801ax/i82801ax_lpc.c
new file mode 100644 (file)
index 0000000..590f057
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2003 Linux Networx
+ * Copyright (C) 2003 SuSE Linux AG
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* From 82801DBM, needs to be fixed to support everything the 82801ER does. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <pc80/mc146818rtc.h>
+#include <pc80/isa-dma.h>
+#include <arch/io.h>
+#include "i82801ax.h"
+
+#define GPIO_BASE_ADDR 0x00000500 /* GPIO Base Address Register */
+
+#define NMI_OFF 0
+
+typedef struct southbridge_intel_i82801ax_config config_t;
+
+/* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control
+ * 0x00 - 0000 = Reserved
+ * 0x01 - 0001 = Reserved
+ * 0x02 - 0010 = Reserved
+ * 0x03 - 0011 = IRQ3
+ * 0x04 - 0100 = IRQ4
+ * 0x05 - 0101 = IRQ5
+ * 0x06 - 0110 = IRQ6
+ * 0x07 - 0111 = IRQ7
+ * 0x08 - 1000 = Reserved
+ * 0x09 - 1001 = IRQ9
+ * 0x0A - 1010 = IRQ10
+ * 0x0B - 1011 = IRQ11
+ * 0x0C - 1100 = IRQ12
+ * 0x0D - 1101 = Reserved
+ * 0x0E - 1110 = IRQ14
+ * 0x0F - 1111 = IRQ15
+ * PIRQ[n]_ROUT[7] - PIRQ Routing Control
+ * 0x80 - The PIRQ is not routed.
+ */
+
+#define PIRQA 0x03
+#define PIRQB 0x04
+#define PIRQC 0x05
+#define PIRQD 0x06
+#define PIRQE 0x07
+#define PIRQF 0x09
+#define PIRQG 0x0A
+#define PIRQH 0x0B
+
+/* 
+ * Use 0x0ef8 for a bitmap to cover all these IRQ's. 
+ * Use the defined IRQ values above or set mainboard
+ * specific IRQ values in your mainboards Config.lb.
+*/
+
+void i82801ax_enable_apic(struct device *dev)
+{
+       uint32_t reg32;
+       volatile uint32_t *ioapic_index = (volatile uint32_t *)0xfec00000;
+       volatile uint32_t *ioapic_data = (volatile uint32_t *)0xfec00010;
+
+       /* Set ACPI base address (I/O space). */
+       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
+
+       /* Enable ACPI I/O and power management. */
+       pci_write_config8(dev, ACPI_CNTL, 0x10);
+
+       reg32 = pci_read_config32(dev, GEN_CNTL);
+       reg32 |= (3 << 7);      /* Enable IOAPIC */
+       reg32 |= (1 << 13);     /* Coprocessor error enable */
+       reg32 |= (1 << 1);      /* Delayed transaction enable */
+       reg32 |= (1 << 2);      /* DMA collection buffer enable */
+       pci_write_config32(dev, GEN_CNTL, reg32);
+       printk_debug("IOAPIC Southbridge enabled %x\n", reg32);
+
+       *ioapic_index = 0;
+       *ioapic_data = (1 << 25);
+
+       *ioapic_index = 0;
+       reg32 = *ioapic_data;
+       printk_debug("Southbridge APIC ID = %x\n", reg32);
+       if (reg32 != (1 << 25))
+               die("APIC Error\n");
+
+       /* TODO: From i82801ca, needed/useful on other ICH? */
+       *ioapic_index = 3; /* Select Boot Configuration register. */
+       *ioapic_data = 1; /* Use Processor System Bus to deliver interrupts. */
+}
+
+void i82801ax_enable_serial_irqs(struct device *dev)
+{
+       /* Set packet length and toggle silent mode bit. */
+       pci_write_config8(dev, SERIRQ_CNTL,
+                         (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0));
+       pci_write_config8(dev, SERIRQ_CNTL,
+                         (1 << 7) | (0 << 6) | ((21 - 17) << 2) | (0 << 0));
+       /* TODO: Explain/#define the real meaning of these magic numbers. */
+}
+
+static void i82801ax_pirq_init(device_t dev, uint16_t ich_model)
+{
+       /* Get the chip configuration */
+       config_t *config = dev->chip_info;
+
+       if (config->pirqa_routing) {
+               pci_write_config8(dev, PIRQA_ROUT, config->pirqa_routing);
+       } else {
+               pci_write_config8(dev, PIRQA_ROUT, PIRQA);
+       }
+
+       if (config->pirqb_routing) {
+               pci_write_config8(dev, PIRQB_ROUT, config->pirqb_routing);
+       } else {
+               pci_write_config8(dev, PIRQB_ROUT, PIRQB);
+       }
+
+       if (config->pirqc_routing) {
+               pci_write_config8(dev, PIRQC_ROUT, config->pirqc_routing);
+       } else {
+               pci_write_config8(dev, PIRQC_ROUT, PIRQC);
+       }
+
+       if (config->pirqd_routing) {
+               pci_write_config8(dev, PIRQD_ROUT, config->pirqd_routing);
+       } else {
+               pci_write_config8(dev, PIRQD_ROUT, PIRQD);
+       }
+
+       /* Route PIRQE - PIRQH (for ICH2-ICH9). */
+       if (ich_model >= 0x2440) {
+
+               if (config->pirqe_routing) {
+                       pci_write_config8(dev, PIRQE_ROUT, config->pirqe_routing);
+               } else {
+                       pci_write_config8(dev, PIRQE_ROUT, PIRQE);
+               }
+
+               if (config->pirqf_routing) {
+                       pci_write_config8(dev, PIRQF_ROUT, config->pirqf_routing);
+               } else {
+                       pci_write_config8(dev, PIRQF_ROUT, PIRQF);
+               }
+
+               if (config->pirqg_routing) {
+                       pci_write_config8(dev, PIRQG_ROUT, config->pirqg_routing);
+               } else {
+                       pci_write_config8(dev, PIRQG_ROUT, PIRQG);
+               }
+
+               if (config->pirqh_routing) {
+                       pci_write_config8(dev, PIRQH_ROUT, config->pirqh_routing);
+               } else {
+                       pci_write_config8(dev, PIRQH_ROUT, PIRQH);
+               }
+       }
+}
+
+static void i82801ax_power_options(device_t dev)
+{
+       uint8_t byte;
+       int pwr_on = -1;
+       int nmi_option;
+
+       /* power after power fail */
+       /* FIXME this doesn't work! */
+       /* Which state do we want to goto after g3 (power restored)?
+        * 0 == S0 Full On
+        * 1 == S5 Soft Off
+        */
+       pci_write_config8(dev, GEN_PMCON_3, pwr_on ? 0 : 1);
+       printk_info("Set power %s if power fails\n", pwr_on ? "on" : "off");
+
+       /* Set up NMI on errors. */
+       byte = inb(0x61);
+       byte &= ~(1 << 3);      /* IOCHK# NMI Enable */
+       byte &= ~(1 << 2);      /* PCI SERR# Enable */
+       outb(byte, 0x61);
+       byte = inb(0x70);
+
+       nmi_option = NMI_OFF;
+       get_option(&nmi_option, "nmi");
+       if (nmi_option) {
+               byte &= ~(1 << 7);      /* Set NMI. */
+               outb(byte, 0x70);
+       }
+}
+
+static void gpio_init(device_t dev, uint16_t ich_model)
+{
+       /* Set the value for GPIO base address register and enable GPIO.
+        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
+        */
+       if (ich_model <= 0x24D0) {
+               pci_write_config32(dev, GPIO_BASE_ICH0_5, (GPIO_BASE_ADDR | 1));
+               pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
+       } else if (ich_model >= 0x2640) {
+               pci_write_config32(dev, GPIO_BASE_ICH6_9, (GPIO_BASE_ADDR | 1));
+               pci_write_config8(dev, GPIO_CNTL_ICH6_9, 0x10);
+       }
+}
+
+void i82801ax_rtc_init(struct device *dev)
+{
+       uint8_t reg8;
+       uint32_t reg32;
+       int rtc_failed;
+
+       reg8 = pci_read_config8(dev, GEN_PMCON_3);
+       rtc_failed = reg8 & RTC_BATTERY_DEAD;
+       if (rtc_failed) {
+               reg8 &= ~(1 << 1);      /* Preserve the power fail state. */
+               pci_write_config8(dev, GEN_PMCON_3, reg8);
+       }
+       reg32 = pci_read_config32(dev, GEN_STS);
+       rtc_failed |= reg32 & (1 << 2);
+       rtc_init(rtc_failed);
+
+       /* Enable access to the upper 128 byte bank of CMOS RAM. */
+       pci_write_config8(dev, RTC_CONF, 0x04);
+}
+
+void i82801ax_lpc_route_dma(struct device *dev, uint8_t mask)
+{
+       uint16_t reg16;
+       int i;
+
+       reg16 = pci_read_config16(dev, PCI_DMA_CFG);
+       reg16 &= 0x300;
+       for (i = 0; i < 8; i++) {
+               if (i == 4)
+                       continue;
+               reg16 |= ((mask & (1 << i)) ? 3 : 1) << (i * 2);
+       }
+       pci_write_config16(dev, PCI_DMA_CFG, reg16);
+}
+
+static void i82801ax_lpc_decode_en(device_t dev, uint16_t ich_model)
+{
+       /* Decode 0x3F8-0x3FF (COM1) for COMA port, 0x2F8-0x2FF (COM2) for COMB.
+        * LPT decode defaults to 0x378-0x37F and 0x778-0x77F.
+        * Floppy decode defaults to 0x3F0-0x3F5, 0x3F7.
+        * We also need to set the value for LPC I/F Enables Register.
+        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
+        */
+       if (ich_model <= 0x24D0) {
+               pci_write_config8(dev, COM_DEC, 0x10);
+               pci_write_config16(dev, LPC_EN_ICH0_5, 0x300F);
+       } else if (ich_model >= 0x2640) {
+               pci_write_config8(dev, LPC_IO_DEC, 0x10);
+               pci_write_config16(dev, LPC_EN_ICH6_9, 0x300F);
+       }
+}
+
+static void enable_hpet(struct device *dev)
+{
+#ifdef HPET_PRESENT
+       uint32_t reg32;
+       uint32_t code = (0 & 0x3);
+
+       reg32 = pci_read_config32(dev, GEN_CNTL);
+       reg32 |= (1 << 17);     /* Enable HPET. */
+       /*
+        * Bits [16:15] Memory Address Range
+        * 00           FED0_0000h - FED0_03FFh
+        * 01           FED0_1000h - FED0_13FFh
+        * 10           FED0_2000h - FED0_23FFh
+        * 11           FED0_3000h - FED0_33FFh
+        */
+       reg32 &= ~(3 << 15);    /* Clear it */
+       reg32 |= (code << 15);
+       /* TODO: reg32 is never written to anywhere? */
+       printk_debug("Enabling HPET @0x%x\n", HPET_ADDR | (code << 12));
+#endif
+}
+
+static void lpc_init(struct device *dev)
+{
+       uint16_t ich_model = pci_read_config16(dev, PCI_DEVICE_ID);
+
+       /* Set the value for PCI command register. */
+       pci_write_config16(dev, PCI_COMMAND, 0x000f);
+
+       /* IO APIC initialization. */
+       i82801ax_enable_apic(dev);
+
+       i82801ax_enable_serial_irqs(dev);
+
+       /* Setup the PIRQ. */
+       i82801ax_pirq_init(dev, ich_model);
+
+       /* Setup power options. */
+       i82801ax_power_options(dev);
+
+       /* Set the state of the GPIO lines. */
+       gpio_init(dev, ich_model);
+
+       /* Initialize the real time clock. */
+       i82801ax_rtc_init(dev);
+
+       /* Route DMA. */
+       i82801ax_lpc_route_dma(dev, 0xff);
+
+       /* Initialize ISA DMA. */
+       isa_dma_init();
+
+       /* Setup decode ports and LPC I/F enables. */
+       i82801ax_lpc_decode_en(dev, ich_model);
+
+       /* Initialize the High Precision Event Timers, if present. */
+       enable_hpet(dev);
+}
+
+static void i82801ax_lpc_read_resources(device_t dev)
+{
+       struct resource *res;
+
+       /* Get the normal PCI resources of this device. */
+       pci_dev_read_resources(dev);
+
+       /* Add an extra subtractive resource for both memory and I/O. */
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void i82801ax_lpc_enable_resources(device_t dev)
+{
+       pci_dev_enable_resources(dev);
+       enable_childrens_resources(dev);
+}
+
+static struct device_operations lpc_ops = {
+       .read_resources         = i82801ax_lpc_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = i82801ax_lpc_enable_resources,
+       .init                   = lpc_init,
+       .scan_bus               = scan_static_bus,
+       .enable                 = i82801ax_enable,
+};
+
+static const struct pci_driver i82801aa_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2410,
+};
+
+static const struct pci_driver i82801ab_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2420,
+};
+
+static const struct pci_driver i82801ba_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2440,
+};
+
+static const struct pci_driver i82801ca_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2480,
+};
+
+static const struct pci_driver i82801db_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24c0,
+};
+
+static const struct pci_driver i82801dbm_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cc,
+};
+
+/* 82801EB and 82801ER */
+static const struct pci_driver i82801ex_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24d0,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_nic.c b/src/southbridge/intel/i82801ax/i82801ax_nic.c
new file mode 100644 (file)
index 0000000..3728d28
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with a NIC. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+
+static struct device_operations nic_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = 0,
+};
+
+/* Note: There's no NIC on 82801AA/AB (ICH/ICH0). */
+
+/* 82801BA/BAM/CA/CAM (ICH2/ICH2-M/ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ba_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_LAN,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_LAN,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_LAN,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_LAN,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_nic1 __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_LAN1,
+};
+
+static const struct pci_driver i82801e_nic2 __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_LAN2,
+};
+
diff --git a/src/southbridge/intel/i82801ax/i82801ax_pci.c b/src/southbridge/intel/i82801ax/i82801ax_pci.c
new file mode 100644 (file)
index 0000000..1f01e5d
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+
+static void pci_init(struct device *dev)
+{
+       uint16_t reg16;
+
+       /* Clear system errors */
+       reg16 = pci_read_config16(dev, 0x06);
+       reg16 |= 0xf900;        /* Clear possible errors */
+       pci_write_config16(dev, 0x06, reg16);
+
+       reg16 = pci_read_config16(dev, 0x1e);
+       reg16 |= 0xf800;        /* Clear possible errors */
+       pci_write_config16(dev, 0x1e, reg16);
+}
+
+static struct device_operations pci_ops = {
+       .read_resources         = pci_bus_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_bus_enable_resources,
+       .init                   = pci_init,
+       .scan_bus               = pci_scan_bridge,
+};
+
+static const struct pci_driver i82801aa_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2418,
+};
+
+static const struct pci_driver i82801ab_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2428,
+};
+
+/* 82801BA, 82801CA, 82801DB, 82801EB, and 82801ER */
+static const struct pci_driver i82801misc_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x244e,
+};
+
+static const struct pci_driver i82801dbm_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2448,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_reset.c b/src/southbridge/intel/i82801ax/i82801ax_reset.c
new file mode 100644 (file)
index 0000000..239a727
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2002 Eric Biederman <ebiederm@xmission.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <arch/io.h>
+
+void hard_reset(void)
+{
+       /* Try rebooting through port 0xcf9. */
+       outb((1 << 2) | (1 << 1), 0xcf9);
+}
diff --git a/src/southbridge/intel/i82801ax/i82801ax_sata.c b/src/southbridge/intel/i82801ax/i82801ax_sata.c
new file mode 100644 (file)
index 0000000..5d6d6f2
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ax.h"
+
+/* TODO: Set dynamically, if the user only wants one SATA channel or none
+ * at all.
+ */
+static void sata_init(struct device *dev)
+{
+       /* SATA configuration */
+       pci_write_config8(dev, 0x04, 0x07);
+       pci_write_config8(dev, 0x09, 0x8f);
+
+       /* Set timmings */
+       pci_write_config16(dev, 0x40, 0x0a307);
+       pci_write_config16(dev, 0x42, 0x0a307);
+
+       /* Sync DMA */
+       pci_write_config16(dev, 0x48, 0x000f);
+       pci_write_config16(dev, 0x4a, 0x1111);
+
+       /* 66 MHz */
+       pci_write_config16(dev, 0x54, 0xf00f);
+
+       /* Combine IDE - SATA configuration */
+       pci_write_config8(dev, 0x90, 0x0);
+
+       /* Port 0 & 1 enable */
+       pci_write_config8(dev, 0x92, 0x33);
+
+       /* Initialize SATA. */
+       pci_write_config16(dev, 0xa0, 0x0018);
+       pci_write_config32(dev, 0xa4, 0x00000264);
+       pci_write_config16(dev, 0xa0, 0x0040);
+       pci_write_config32(dev, 0xa4, 0x00220043);
+}
+
+static struct device_operations sata_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = sata_init,
+       .scan_bus               = 0,
+       .enable                 = i82801ax_enable,
+};
+
+/* 82801EB */
+static const struct pci_driver i82801eb_sata_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24d1,
+};
+
+/* 82801ER */
+static const struct pci_driver i82801er_sata_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24df,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_smbus.c b/src/southbridge/intel/i82801ax/i82801ax_smbus.c
new file mode 100644 (file)
index 0000000..739cfdb
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* TODO: Check datasheets if this will work for all ICH* southbridges. */
+
+#include <stdint.h>
+#include <smbus.h>
+#include <pci.h>
+#include <arch/io.h>
+#include "i82801ax.h"
+#include "i82801_smbus.h"
+
+static int smbus_read_byte(struct bus *bus, device_t dev, u8 address)
+{
+       unsigned device;        /* TODO: u16? */
+       struct resource *res;
+
+       device = dev->path.i2c.device;
+       res = find_resource(bus->dev, 0x20);
+
+       return do_smbus_read_byte(res->base, device, address);
+}
+
+static struct smbus_bus_operations lops_smbus_bus = {
+       .read_byte      = smbus_read_byte,
+};
+
+static const struct device_operations smbus_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = scan_static_bus,
+       .enable                 = i82801er_enable,
+       .ops_smbus_bus          = &lops_smbus_bus,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_SMB,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_SMB,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_SMB,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_SMB,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_SMB,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_SMB,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_SMB,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_SMB,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_smbus.h b/src/southbridge/intel/i82801ax/i82801ax_smbus.h
new file mode 100644 (file)
index 0000000..7a78508
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <device/smbus_def.h>
+
+static void smbus_delay(void)
+{
+       inb(0x80);
+}
+
+static int smbus_wait_until_ready(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while (byte & 1);
+       return loops ? 0 : -1;
+}
+
+static int smbus_wait_until_done(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while ((byte & 1) || (byte & ~((1 << 6) | (1 << 0))) == 0);
+       return loops ? 0 : -1;
+}
+
+static int smbus_wait_until_blk_done(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while ((byte & (1 << 7)) == 0);
+       return loops ? 0 : -1;
+}
+
+static int do_smbus_read_byte(unsigned device, unsigned address)
+{
+       unsigned char global_status_register;
+       unsigned char byte;
+
+       if (smbus_wait_until_ready() < 0) {
+               return SMBUS_WAIT_UNTIL_READY_TIMEOUT;
+       }
+       /* Setup transaction */
+       /* Disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+       /* Set the device I'm talking too */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
+       /* Set the command/address... */
+       outb(address & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
+       /* Set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2 << 2),
+            (SMBUS_IO_BASE + SMBHSTCTL));
+       /* Clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* Clear the data byte... */
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* Start the command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40),
+            SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Poll for transaction completion */
+       if (smbus_wait_until_done() < 0) {
+               return SMBUS_WAIT_UNTIL_DONE_TIMEOUT;
+       }
+
+       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* Ignore the "In Use" status... */
+       global_status_register &= ~(3 << 5);
+
+       /* Read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+       if (global_status_register != (1 << 1)) {
+               return SMBUS_ERROR;
+       }
+       return byte;
+}
+
+/* This function is neither used nor tested by me (Corey Osgood), the author 
+(Yinghai) probably tested/used it on i82801er */
+static int do_smbus_write_block(unsigned device, unsigned length, unsigned cmd,
+                               unsigned data1, unsigned data2)
+{
+#warning "do_smbus_write_block is commented out"
+       print_err("Untested smbus_write_block called\r\n");
+#if 0
+       unsigned char global_control_register;
+       unsigned char global_status_register;
+       unsigned char byte;
+       unsigned char stat;
+       int i;
+
+       /* Clear the PM timeout flags, SECOND_TO_STS */
+       outw(inw(0x0400 + 0x66), 0x0400 + 0x66);
+
+       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
+               return -2;
+       }
+
+       /* Setup transaction */
+       /* Obtain ownership */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+       for (stat = 0; (stat & 0x40) == 0;) {
+               stat = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+       /* Clear the done bit */
+       outb(0x80, SMBUS_IO_BASE + SMBHSTSTAT);
+       /* Disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Set the device I'm talking too */
+       outb(((device & 0x7f) << 1), SMBUS_IO_BASE + SMBXMITADD);
+
+       /* Set the command address */
+       outb(cmd & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
+
+       /* Set the block length */
+       outb(length & 0xff, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* Try sending out the first byte of data here */
+       byte = (data1 >> (0)) & 0x0ff;
+       outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
+       /* Issue a block write command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x5 << 2) | 0x40,
+            SMBUS_IO_BASE + SMBHSTCTL);
+
+       for (i = 0; i < length; i++) {
+
+               /* Poll for transaction completion */
+               if (smbus_wait_until_blk_done(SMBUS_IO_BASE) < 0) {
+                       return -3;
+               }
+
+               /* Load the next byte */
+               if (i > 3)
+                       byte = (data2 >> (i % 4)) & 0x0ff;
+               else
+                       byte = (data1 >> (i)) & 0x0ff;
+               outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
+
+               /* Clear the done bit */
+               outb(inb(SMBUS_IO_BASE + SMBHSTSTAT),
+                    SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+
+       print_debug("SMBUS Block complete\r\n");
+       return 0;
+#endif
+}
diff --git a/src/southbridge/intel/i82801ax/i82801ax_usb.c b/src/southbridge/intel/i82801ax/i82801ax_usb.c
new file mode 100644 (file)
index 0000000..a1d36e8
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with USB. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ax.h"
+
+static void usb_init(struct device *dev)
+{
+       /* TODO: Any init needed? Some ports have it, others don't. */
+}
+
+static struct device_operations usb_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = usb_init,
+       .scan_bus               = 0,
+       .enable                 = i82801ax_enable,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_USB,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_USB,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_USB1,
+};
+
+static const struct pci_driver i82801ba_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_USB2,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB1,
+};
+
+static const struct pci_driver i82801ca_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB2,
+};
+
+static const struct pci_driver i82801ca_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB3,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB1,
+};
+
+static const struct pci_driver i82801db_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB2,
+};
+
+static const struct pci_driver i82801db_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB3,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB1,
+};
+
+static const struct pci_driver i82801eb_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB2,
+};
+
+static const struct pci_driver i82801eb_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB3,
+};
+
+static const struct pci_driver i82801eb_usb4 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB4,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB1,
+};
+
+static const struct pci_driver i82801fb_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB2,
+};
+
+static const struct pci_driver i82801fb_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB3,
+};
+
+static const struct pci_driver i82801fb_usb4 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB4,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_usb __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_USB,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_usb_ehci.c b/src/southbridge/intel/i82801ax/i82801ax_usb_ehci.c
new file mode 100644 (file)
index 0000000..a3f7e7c
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ax.h"
+
+static void usb_ehci_init(struct device *dev)
+{
+       /* TODO: Is any special init really needed? */
+       uint32_t cmd;
+
+       printk_debug("EHCI: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
+
+       printk_debug("done.\n");
+}
+
+static void usb_ehci_set_subsystem(device_t dev, unsigned vendor,
+                                  unsigned device)
+{
+       uint8_t access_cntl;
+
+       access_cntl = pci_read_config8(dev, 0x80);
+
+       /* Enable writes to protected registers. */
+       pci_write_config8(dev, 0x80, access_cntl | 1);
+
+       /* Write the subsystem vendor and device ID. */
+       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
+                          ((device & 0xffff) << 16) | (vendor & 0xffff));
+
+       /* Restore protection. */
+       pci_write_config8(dev, 0x80, access_cntl);
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem  = &usb_ehci_set_subsystem,
+};
+
+static struct device_operations usb_ehci_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = usb_ehci_init,
+       .scan_bus               = 0,
+       .enable                 = i82801ax_enable,
+       .ops_pci                = &lops_pci,
+};
+
+/* 82801DB and 82801DBM */
+static const struct pci_driver i82801db_usb_ehci __pci_driver = {
+       .ops    = &usb_ehci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cd,
+};
+
+/* 82801EB and 82801ER */
+static const struct pci_driver i82801ex_usb_ehci __pci_driver = {
+       .ops    = &usb_ehci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24dd,
+};
diff --git a/src/southbridge/intel/i82801ax/i82801ax_watchdog.c b/src/southbridge/intel/i82801ax/i82801ax_watchdog.c
new file mode 100644 (file)
index 0000000..aea10e1
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2006 John Dufresne <jon.dufresne@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pci.h>
+
+/* TODO: I'm fairly sure the same functionality is provided elsewhere. */
+
+void watchdog_off(void)
+{
+       device_t dev;
+       unsigned long value, base;
+
+       /* Turn off the ICH5 watchdog. */
+       dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0));
+
+       /* Enable I/O space. */
+       value = pci_read_config16(dev, 0x04);
+       value |= (1 << 10);
+       pci_write_config16(dev, 0x04, value);
+
+       /* Get TCO base. */
+       base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
+
+       /* Disable the watchdog timer. */
+       value = inw(base + 0x08);
+       value |= 1 << 11;
+       outw(value, base + 0x08);
+
+       /* Clear TCO timeout status. */
+       outw(0x0008, base + 0x04);
+       outw(0x0002, base + 0x06);
+
+       printk_debug("ICH Watchdog disabled\r\n");
+}
diff --git a/src/southbridge/intel/i82801bx/Kconfig b/src/southbridge/intel/i82801bx/Kconfig
new file mode 100644 (file)
index 0000000..682b725
--- /dev/null
@@ -0,0 +1,23 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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 SOUTHBRIDGE_INTEL_I82801BX
+       bool
+
diff --git a/src/southbridge/intel/i82801bx/Makefile.inc b/src/southbridge/intel/i82801bx/Makefile.inc
new file mode 100644 (file)
index 0000000..3d7d618
--- /dev/null
@@ -0,0 +1,38 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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
+##
+
+driver-y += i82801bx.o
+driver-y += i82801bx_ac97.o
+driver-y += i82801bx_ide.o
+driver-y += i82801bx_lpc.o
+driver-y += i82801bx_nic.o
+driver-y += i82801bx_pci.o
+driver-y += i82801bx_sata.o
+# driver-y += i82801bx_smbus.o
+driver-y += i82801bx_usb.o
+driver-y += i82801bx_usb_ehci.o
+
+obj-y += i82801bx_reset.o
+obj-y += i82801bx_watchdog.o
+
+# TODO: What about cmos_failover.c?
+
+# TODO: Fix and enable i82801bx_smbus.o later.
+
diff --git a/src/southbridge/intel/i82801bx/chip.h b/src/southbridge/intel/i82801bx/chip.h
new file mode 100644 (file)
index 0000000..a168e85
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey_osgood@verizon.net>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/*
+ * The i82801bx code currently supports:
+ *  - 82801AA
+ *  - 82801AB
+ *  - 82801BA
+ *  - 82801CA
+ *  - 82801DB
+ *  - 82801DBM
+ *  - 82801EB
+ *  - 82801ER
+ *
+ * This code should NOT be used for ICH6 and later versions.
+ */
+
+#ifndef SOUTHBRIDGE_INTEL_I82801BX_CHIP_H
+#define SOUTHBRIDGE_INTEL_I82801BX_CHIP_H
+
+struct southbridge_intel_i82801bx_config {
+       /**
+        * Interrupt Routing configuration
+        * If bit7 is 1, the interrupt is disabled.
+        */
+       uint8_t pirqa_routing;
+       uint8_t pirqb_routing;
+       uint8_t pirqc_routing;
+       uint8_t pirqd_routing;
+       uint8_t pirqe_routing;
+       uint8_t pirqf_routing;
+       uint8_t pirqg_routing;
+       uint8_t pirqh_routing;
+
+       uint8_t ide0_enable;
+       uint8_t ide1_enable;
+};
+
+extern struct chip_operations southbridge_intel_i82801bx_ops;
+
+#endif
diff --git a/src/southbridge/intel/i82801bx/cmos_failover.c b/src/southbridge/intel/i82801bx/cmos_failover.c
new file mode 100644 (file)
index 0000000..d2e4081
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 "i82801bx.h"
+
+static void check_cmos_failed(void)
+{
+       uint8_t byte;
+       byte = pci_read_config8(PCI_DEV(0, 0x1f, 0), GEN_PMCON_3);
+       if (byte & RTC_FAILED) {
+               //clear bit 1 and bit 2
+               byte = cmos_read(RTC_BOOT_BYTE);
+               byte &= 0x0c;
+               byte |= CONFIG_MAX_REBOOT_CNT << 4;
+               cmos_write(byte, RTC_BOOT_BYTE);
+       }
+}
diff --git a/src/southbridge/intel/i82801bx/i82801bx.c b/src/southbridge/intel/i82801bx/i82801bx.c
new file mode 100644 (file)
index 0000000..2352723
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Digital Design Corporation
+ * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include "i82801bx.h"
+
+void i82801bx_enable(device_t dev)
+{
+       unsigned int index = 0;
+       uint16_t cur_disable_mask, new_disable_mask;
+
+       /* All 82801xx devices should be on bus 0. */
+       unsigned int devfn = PCI_DEVFN(0x1f, 0);        // LPC
+       device_t lpc_dev = dev_find_slot(0, devfn);     // 0
+       if (!lpc_dev)
+               return;
+
+       /* We're going to assume, perhaps incorrectly, that if a function
+        * exists it can be disabled. Workarounds for ICH variants that don't
+        * follow this should be done by checking the device ID.
+        */
+       if (PCI_SLOT(dev->path.pci.devfn) == 31) {
+               index = PCI_FUNC(dev->path.pci.devfn);
+       } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
+               index = 8 + PCI_FUNC(dev->path.pci.devfn);
+       }
+
+       /* Function 0 is a bit of an exception. */
+       if (index == 0) {
+               index = 14;
+       }
+
+       cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
+       new_disable_mask = cur_disable_mask & ~(1 << index); /* Enable it. */
+       if (!dev->enabled) {
+               new_disable_mask |= (1 << index); /* Disable it, if desired. */
+       }
+       if (new_disable_mask != cur_disable_mask) {
+               pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
+       }
+}
+
+struct chip_operations southbridge_intel_i82801bx_ops = {
+       CHIP_NAME("Intel ICH2 (82801Bx) Series Southbridge")
+       .enable_dev = i82801bx_enable,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx.h b/src/southbridge/intel/i82801bx/i82801bx.h
new file mode 100644 (file)
index 0000000..9705bee
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 SOUTHBRIDGE_INTEL_I82801BX_I82801BX_H
+#define SOUTHBRIDGE_INTEL_I82801BX_I82801BX_H
+
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
+#include "chip.h"
+extern void i82801bx_enable(device_t dev);
+#endif
+
+#define PCI_DMA_CFG            0x90
+#define SERIRQ_CNTL            0x64
+#define GEN_CNTL               0xd0
+#define GEN_STS                        0xd4
+#define RTC_CONF               0xd8
+#define GEN_PMCON_3            0xa4
+
+#define PMBASE                 0x40
+#define PMBASE_ADDR            0x0400 /* ACPI Base Address Register */
+#define ACPI_CNTL              0x44
+#define BIOS_CNTL              0x4E
+#define GPIO_BASE_ICH0_5       0x58 /* LPC GPIO Base Addr. Reg. (ICH0-ICH5) */
+#define GPIO_BASE_ICH6_9       0x48 /* LPC GPIO Base Address Register (ICH6-ICH9) */
+#define GPIO_CNTL_ICH0_5       0x5C /* LPC GPIO Control Register (ICH0-ICH5) */
+#define GPIO_CNTL_ICH6_9       0x4C /* LPC GPIO Control Register (ICH6-ICH9) */
+
+#define PIRQA_ROUT             0x60
+#define PIRQB_ROUT             0x61
+#define PIRQC_ROUT             0x62
+#define PIRQD_ROUT             0x63
+#define PIRQE_ROUT             0x68
+#define PIRQF_ROUT             0x69
+#define PIRQG_ROUT             0x6A
+#define PIRQH_ROUT             0x6B
+
+#define FUNC_DIS               0xF2
+
+#define COM_DEC                        0xE0 /* LPC I/F Communication Port Decode Ranges (ICH0-ICH5) */
+#define LPC_IO_DEC             0x80 /* IO Decode Ranges Register (ICH6-ICH9) */
+#define LPC_EN_ICH0_5          0xE6 /* LPC IF Enables Register (ICH0-ICH5) */
+#define LPC_EN_ICH6_9          0x82 /* LPC IF Enables Register (ICH6-ICH9) */
+
+#define SBUS_NUM               0x19
+#define SUB_BUS_NUM            0x1A
+#define SMLT                   0x1B
+#define IOBASE                 0x1C
+#define IOLIM                  0x1D
+#define MEMBASE                        0x20
+#define MEMLIM                 0x22
+#define CNF                    0x50
+#define MTT                    0x70
+#define PCI_MAST_STS           0x82
+
+#define TCOBASE                        0x60 /* TCO Base Address Register */
+#define TCO1_CNT               0x08 /* TCO1 Control Register */
+
+/* GEN_PMCON_3 bits */
+#define RTC_BATTERY_DEAD       (1 << 2)
+#define RTC_POWER_FAILED       (1 << 1)
+#define SLEEP_AFTER_POWER_FAIL (1 << 0)
+
+/* PCI Configuration Space (D31:F1) */
+#define IDE_TIM_PRI            0x40    /* IDE timings, primary */
+#define IDE_TIM_SEC            0x42    /* IDE timings, secondary */
+
+/* IDE_TIM bits */
+#define IDE_DECODE_ENABLE      (1 << 15)
+
+/* PCI Configuration Space (D31:F3) */
+#define SMB_BASE               0x20
+#define HOSTC                  0x40
+
+/* HOSTC bits */
+#define I2C_EN                 (1 << 2)
+#define SMB_SMI_EN             (1 << 1)
+#define HST_EN                 (1 << 0)
+
+/* SMBus I/O bits.
+ * TODO: Does it matter where we put the SMBus IO base, as long as we keep
+ * consistent and don't interfere with anything else?
+ */
+/* #define SMBUS_IO_BASE 0x1000 */
+#define SMBUS_IO_BASE          0x0f00
+
+#define SMBHSTSTAT             0x0
+#define SMBHSTCTL              0x2
+#define SMBHSTCMD              0x3
+#define SMBXMITADD             0x4
+#define SMBHSTDAT0             0x5
+#define SMBHSTDAT1             0x6
+#define SMBBLKDAT              0x7
+#define SMBTRNSADD             0x9
+#define SMBSLVDATA             0xa
+#define SMLINK_PIN_CTL         0xe
+#define SMBUS_PIN_CTL          0xf
+
+#define SMBUS_TIMEOUT          (10 * 1000 * 100)
+
+/* HPET, if present */
+#define HPET_ADDR              0xfed0000
+
+#endif                         /* SOUTHBRIDGE_INTEL_I82801BX_I82801BX_H */
+
diff --git a/src/southbridge/intel/i82801bx/i82801bx_ac97.c b/src/southbridge/intel/i82801bx/i82801bx_ac97.c
new file mode 100644 (file)
index 0000000..2966d20
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with AC97 audio/modem. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801bx.h"
+
+static struct device_operations ac97_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = 0,
+       .enable                 = i82801bx_enable,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801aa_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_MODEM,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ab_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_MODEM,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ba_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_MODEM,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801ca_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_MODEM,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801db_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_MODEM,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801eb_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_MODEM,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_ac97_audio __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_AUDIO,
+};
+
+static const struct pci_driver i82801fb_ac97_modem __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_MODEM,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_early_lpc.c b/src/southbridge/intel/i82801bx/i82801bx_early_lpc.c
new file mode 100644 (file)
index 0000000..b64c3d8
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008 Joseph Smith <joe@settoplinux.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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
+ *
+ */
+
+static void i82801bx_halt_tco_timer(void)
+{
+       device_t dev;
+       uint16_t halt_tco_timer;
+
+       /* Set the LPC device statically. */
+       dev = PCI_DEV(0x0, 0x1f, 0x0);
+
+       /* Temporarily set ACPI base address (I/O space). */
+       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
+
+       /* Temporarily enable ACPI I/O. */
+       pci_write_config8(dev, ACPI_CNTL, 0x10);
+
+       /* Halt the TCO timer, preventing SMI and automatic reboot */
+       outw(inw(PMBASE_ADDR + TCOBASE + TCO1_CNT) | (1 << 11), PMBASE_ADDR + TCOBASE + TCO1_CNT);
+
+       /* Disable ACPI I/O. */
+       pci_write_config8(dev, ACPI_CNTL, 0x00);
+}
diff --git a/src/southbridge/intel/i82801bx/i82801bx_early_smbus.c b/src/southbridge/intel/i82801bx/i82801bx_early_smbus.c
new file mode 100644 (file)
index 0000000..b8ec9b7
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <device/pci_ids.h>
+#include "i82801bx.h"
+#include "i82801bx_smbus.h"
+
+static void enable_smbus(void)
+{
+       device_t dev;
+       uint16_t device_id;
+
+       /* Set the SMBus device statically. */
+       dev = PCI_DEV(0x0, 0x1f, 0x3);
+
+       /* Check to make sure we've got the right device. */
+       device_id = pci_read_config16(dev, 0x2);
+
+       /* Clear bits 7-4 (the only bits that vary between models). */
+       device_id &= 0xff0f;
+
+       if (device_id != 0x2403) {
+               die("Device not found, Corey probably screwed up!");
+       }
+
+       /* Set SMBus I/O base. */
+       pci_write_config32(dev, SMB_BASE,
+                          SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+
+       /* Set SMBus enable. */
+       pci_write_config8(dev, HOSTC, HST_EN);
+
+       /* Set SMBus I/O space enable. */
+       pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
+
+       /* Disable interrupt generation. */
+       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Clear any lingering errors, so transactions can run. */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       print_debug("SMBus controller enabled\r\n");
+}
+
+static inline int smbus_read_byte(unsigned device, unsigned address)
+{
+       return do_smbus_read_byte(device, address);
+}
+
+static void smbus_write_byte(unsigned device, unsigned address,
+                            unsigned char val)
+{
+       print_err("Unimplemented smbus_write_byte() called\r\n");
+       return;
+}
+
+static inline int smbus_write_block(unsigned device, unsigned length,
+                                   unsigned cmd, unsigned data1,
+                                   unsigned data2)
+{
+       return do_smbus_write_block(device, length, cmd, data1, data2);
+}
diff --git a/src/southbridge/intel/i82801bx/i82801bx_ide.c b/src/southbridge/intel/i82801bx/i82801bx_ide.c
new file mode 100644 (file)
index 0000000..9bfab00
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ * Copyright (C) 2005 Digital Design Corporation
+ * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801bx.h"
+
+typedef struct southbridge_intel_i82801bx_config config_t;
+
+static void ide_init(struct device *dev)
+{
+       /* Get the chip configuration */
+       config_t *config = dev->chip_info; 
+
+       /* TODO: Needs to be tested for compatibility with ICH5(R). */
+       /* Enable IDE devices so the Linux IDE driver will work. */
+       uint16_t ideTimingConfig;
+
+       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
+       ideTimingConfig &= ~IDE_DECODE_ENABLE;
+       if (!config || config->ide0_enable) {
+               /* Enable primary IDE interface. */
+               ideTimingConfig |= IDE_DECODE_ENABLE;
+               printk_debug("IDE0: Primary IDE interface is enabled\n");
+       } else {
+               printk_info("IDE0: Primary IDE interface is disabled\n");
+       }
+       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
+
+       ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
+       ideTimingConfig &= ~IDE_DECODE_ENABLE;
+       if (!config || config->ide1_enable) {
+               /* Enable secondary IDE interface. */
+               ideTimingConfig |= IDE_DECODE_ENABLE;
+               printk_debug("IDE1: Secondary IDE interface is enabled\n");
+       } else {
+               printk_info("IDE1: Secondary IDE interface is disabled\n");
+       }
+       pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
+}
+
+static struct device_operations ide_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = ide_init,
+       .scan_bus               = 0,
+       .enable                 = i82801bx_enable,
+};
+
+/* 82801AA */
+static const struct pci_driver i82801aa_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2411,
+};
+
+/* 82801AB */
+static const struct pci_driver i82801ab_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2421,
+};
+
+/* 82801BA */
+static const struct pci_driver i82801ba_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x244b,
+};
+
+/* 82801CA */
+static const struct pci_driver i82801ca_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x248b,
+};
+
+/* 82801DB */
+static const struct pci_driver i82801db_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cb,
+};
+
+/* 82801DBM */
+static const struct pci_driver i82801dbm_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24ca,
+};
+
+/* 82801EB & 82801ER */
+static const struct pci_driver i82801ex_ide __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24db,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_lpc.c b/src/southbridge/intel/i82801bx/i82801bx_lpc.c
new file mode 100644 (file)
index 0000000..4691ed4
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2003 Linux Networx
+ * Copyright (C) 2003 SuSE Linux AG
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* From 82801DBM, needs to be fixed to support everything the 82801ER does. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <pc80/mc146818rtc.h>
+#include <pc80/isa-dma.h>
+#include <arch/io.h>
+#include "i82801bx.h"
+
+#define GPIO_BASE_ADDR 0x00000500 /* GPIO Base Address Register */
+
+#define NMI_OFF 0
+
+typedef struct southbridge_intel_i82801bx_config config_t;
+
+/* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control
+ * 0x00 - 0000 = Reserved
+ * 0x01 - 0001 = Reserved
+ * 0x02 - 0010 = Reserved
+ * 0x03 - 0011 = IRQ3
+ * 0x04 - 0100 = IRQ4
+ * 0x05 - 0101 = IRQ5
+ * 0x06 - 0110 = IRQ6
+ * 0x07 - 0111 = IRQ7
+ * 0x08 - 1000 = Reserved
+ * 0x09 - 1001 = IRQ9
+ * 0x0A - 1010 = IRQ10
+ * 0x0B - 1011 = IRQ11
+ * 0x0C - 1100 = IRQ12
+ * 0x0D - 1101 = Reserved
+ * 0x0E - 1110 = IRQ14
+ * 0x0F - 1111 = IRQ15
+ * PIRQ[n]_ROUT[7] - PIRQ Routing Control
+ * 0x80 - The PIRQ is not routed.
+ */
+
+#define PIRQA 0x03
+#define PIRQB 0x04
+#define PIRQC 0x05
+#define PIRQD 0x06
+#define PIRQE 0x07
+#define PIRQF 0x09
+#define PIRQG 0x0A
+#define PIRQH 0x0B
+
+/* 
+ * Use 0x0ef8 for a bitmap to cover all these IRQ's. 
+ * Use the defined IRQ values above or set mainboard
+ * specific IRQ values in your mainboards Config.lb.
+*/
+
+void i82801bx_enable_apic(struct device *dev)
+{
+       uint32_t reg32;
+       volatile uint32_t *ioapic_index = (volatile uint32_t *)0xfec00000;
+       volatile uint32_t *ioapic_data = (volatile uint32_t *)0xfec00010;
+
+       /* Set ACPI base address (I/O space). */
+       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
+
+       /* Enable ACPI I/O and power management. */
+       pci_write_config8(dev, ACPI_CNTL, 0x10);
+
+       reg32 = pci_read_config32(dev, GEN_CNTL);
+       reg32 |= (3 << 7);      /* Enable IOAPIC */
+       reg32 |= (1 << 13);     /* Coprocessor error enable */
+       reg32 |= (1 << 1);      /* Delayed transaction enable */
+       reg32 |= (1 << 2);      /* DMA collection buffer enable */
+       pci_write_config32(dev, GEN_CNTL, reg32);
+       printk_debug("IOAPIC Southbridge enabled %x\n", reg32);
+
+       *ioapic_index = 0;
+       *ioapic_data = (1 << 25);
+
+       *ioapic_index = 0;
+       reg32 = *ioapic_data;
+       printk_debug("Southbridge APIC ID = %x\n", reg32);
+       if (reg32 != (1 << 25))
+               die("APIC Error\n");
+
+       /* TODO: From i82801ca, needed/useful on other ICH? */
+       *ioapic_index = 3; /* Select Boot Configuration register. */
+       *ioapic_data = 1; /* Use Processor System Bus to deliver interrupts. */
+}
+
+void i82801bx_enable_serial_irqs(struct device *dev)
+{
+       /* Set packet length and toggle silent mode bit. */
+       pci_write_config8(dev, SERIRQ_CNTL,
+                         (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0));
+       pci_write_config8(dev, SERIRQ_CNTL,
+                         (1 << 7) | (0 << 6) | ((21 - 17) << 2) | (0 << 0));
+       /* TODO: Explain/#define the real meaning of these magic numbers. */
+}
+
+static void i82801bx_pirq_init(device_t dev, uint16_t ich_model)
+{
+       /* Get the chip configuration */
+       config_t *config = dev->chip_info;
+
+       if (config->pirqa_routing) {
+               pci_write_config8(dev, PIRQA_ROUT, config->pirqa_routing);
+       } else {
+               pci_write_config8(dev, PIRQA_ROUT, PIRQA);
+       }
+
+       if (config->pirqb_routing) {
+               pci_write_config8(dev, PIRQB_ROUT, config->pirqb_routing);
+       } else {
+               pci_write_config8(dev, PIRQB_ROUT, PIRQB);
+       }
+
+       if (config->pirqc_routing) {
+               pci_write_config8(dev, PIRQC_ROUT, config->pirqc_routing);
+       } else {
+               pci_write_config8(dev, PIRQC_ROUT, PIRQC);
+       }
+
+       if (config->pirqd_routing) {
+               pci_write_config8(dev, PIRQD_ROUT, config->pirqd_routing);
+       } else {
+               pci_write_config8(dev, PIRQD_ROUT, PIRQD);
+       }
+
+       /* Route PIRQE - PIRQH (for ICH2-ICH9). */
+       if (ich_model >= 0x2440) {
+
+               if (config->pirqe_routing) {
+                       pci_write_config8(dev, PIRQE_ROUT, config->pirqe_routing);
+               } else {
+                       pci_write_config8(dev, PIRQE_ROUT, PIRQE);
+               }
+
+               if (config->pirqf_routing) {
+                       pci_write_config8(dev, PIRQF_ROUT, config->pirqf_routing);
+               } else {
+                       pci_write_config8(dev, PIRQF_ROUT, PIRQF);
+               }
+
+               if (config->pirqg_routing) {
+                       pci_write_config8(dev, PIRQG_ROUT, config->pirqg_routing);
+               } else {
+                       pci_write_config8(dev, PIRQG_ROUT, PIRQG);
+               }
+
+               if (config->pirqh_routing) {
+                       pci_write_config8(dev, PIRQH_ROUT, config->pirqh_routing);
+               } else {
+                       pci_write_config8(dev, PIRQH_ROUT, PIRQH);
+               }
+       }
+}
+
+static void i82801bx_power_options(device_t dev)
+{
+       uint8_t byte;
+       int pwr_on = -1;
+       int nmi_option;
+
+       /* power after power fail */
+       /* FIXME this doesn't work! */
+       /* Which state do we want to goto after g3 (power restored)?
+        * 0 == S0 Full On
+        * 1 == S5 Soft Off
+        */
+       pci_write_config8(dev, GEN_PMCON_3, pwr_on ? 0 : 1);
+       printk_info("Set power %s if power fails\n", pwr_on ? "on" : "off");
+
+       /* Set up NMI on errors. */
+       byte = inb(0x61);
+       byte &= ~(1 << 3);      /* IOCHK# NMI Enable */
+       byte &= ~(1 << 2);      /* PCI SERR# Enable */
+       outb(byte, 0x61);
+       byte = inb(0x70);
+
+       nmi_option = NMI_OFF;
+       get_option(&nmi_option, "nmi");
+       if (nmi_option) {
+               byte &= ~(1 << 7);      /* Set NMI. */
+               outb(byte, 0x70);
+       }
+}
+
+static void gpio_init(device_t dev, uint16_t ich_model)
+{
+       /* Set the value for GPIO base address register and enable GPIO.
+        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
+        */
+       if (ich_model <= 0x24D0) {
+               pci_write_config32(dev, GPIO_BASE_ICH0_5, (GPIO_BASE_ADDR | 1));
+               pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
+       } else if (ich_model >= 0x2640) {
+               pci_write_config32(dev, GPIO_BASE_ICH6_9, (GPIO_BASE_ADDR | 1));
+               pci_write_config8(dev, GPIO_CNTL_ICH6_9, 0x10);
+       }
+}
+
+void i82801bx_rtc_init(struct device *dev)
+{
+       uint8_t reg8;
+       uint32_t reg32;
+       int rtc_failed;
+
+       reg8 = pci_read_config8(dev, GEN_PMCON_3);
+       rtc_failed = reg8 & RTC_BATTERY_DEAD;
+       if (rtc_failed) {
+               reg8 &= ~(1 << 1);      /* Preserve the power fail state. */
+               pci_write_config8(dev, GEN_PMCON_3, reg8);
+       }
+       reg32 = pci_read_config32(dev, GEN_STS);
+       rtc_failed |= reg32 & (1 << 2);
+       rtc_init(rtc_failed);
+
+       /* Enable access to the upper 128 byte bank of CMOS RAM. */
+       pci_write_config8(dev, RTC_CONF, 0x04);
+}
+
+void i82801bx_lpc_route_dma(struct device *dev, uint8_t mask)
+{
+       uint16_t reg16;
+       int i;
+
+       reg16 = pci_read_config16(dev, PCI_DMA_CFG);
+       reg16 &= 0x300;
+       for (i = 0; i < 8; i++) {
+               if (i == 4)
+                       continue;
+               reg16 |= ((mask & (1 << i)) ? 3 : 1) << (i * 2);
+       }
+       pci_write_config16(dev, PCI_DMA_CFG, reg16);
+}
+
+static void i82801bx_lpc_decode_en(device_t dev, uint16_t ich_model)
+{
+       /* Decode 0x3F8-0x3FF (COM1) for COMA port, 0x2F8-0x2FF (COM2) for COMB.
+        * LPT decode defaults to 0x378-0x37F and 0x778-0x77F.
+        * Floppy decode defaults to 0x3F0-0x3F5, 0x3F7.
+        * We also need to set the value for LPC I/F Enables Register.
+        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
+        */
+       if (ich_model <= 0x24D0) {
+               pci_write_config8(dev, COM_DEC, 0x10);
+               pci_write_config16(dev, LPC_EN_ICH0_5, 0x300F);
+       } else if (ich_model >= 0x2640) {
+               pci_write_config8(dev, LPC_IO_DEC, 0x10);
+               pci_write_config16(dev, LPC_EN_ICH6_9, 0x300F);
+       }
+}
+
+static void enable_hpet(struct device *dev)
+{
+#ifdef HPET_PRESENT
+       uint32_t reg32;
+       uint32_t code = (0 & 0x3);
+
+       reg32 = pci_read_config32(dev, GEN_CNTL);
+       reg32 |= (1 << 17);     /* Enable HPET. */
+       /*
+        * Bits [16:15] Memory Address Range
+        * 00           FED0_0000h - FED0_03FFh
+        * 01           FED0_1000h - FED0_13FFh
+        * 10           FED0_2000h - FED0_23FFh
+        * 11           FED0_3000h - FED0_33FFh
+        */
+       reg32 &= ~(3 << 15);    /* Clear it */
+       reg32 |= (code << 15);
+       /* TODO: reg32 is never written to anywhere? */
+       printk_debug("Enabling HPET @0x%x\n", HPET_ADDR | (code << 12));
+#endif
+}
+
+static void lpc_init(struct device *dev)
+{
+       uint16_t ich_model = pci_read_config16(dev, PCI_DEVICE_ID);
+
+       /* Set the value for PCI command register. */
+       pci_write_config16(dev, PCI_COMMAND, 0x000f);
+
+       /* IO APIC initialization. */
+       i82801bx_enable_apic(dev);
+
+       i82801bx_enable_serial_irqs(dev);
+
+       /* Setup the PIRQ. */
+       i82801bx_pirq_init(dev, ich_model);
+
+       /* Setup power options. */
+       i82801bx_power_options(dev);
+
+       /* Set the state of the GPIO lines. */
+       gpio_init(dev, ich_model);
+
+       /* Initialize the real time clock. */
+       i82801bx_rtc_init(dev);
+
+       /* Route DMA. */
+       i82801bx_lpc_route_dma(dev, 0xff);
+
+       /* Initialize ISA DMA. */
+       isa_dma_init();
+
+       /* Setup decode ports and LPC I/F enables. */
+       i82801bx_lpc_decode_en(dev, ich_model);
+
+       /* Initialize the High Precision Event Timers, if present. */
+       enable_hpet(dev);
+}
+
+static void i82801bx_lpc_read_resources(device_t dev)
+{
+       struct resource *res;
+
+       /* Get the normal PCI resources of this device. */
+       pci_dev_read_resources(dev);
+
+       /* Add an extra subtractive resource for both memory and I/O. */
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void i82801bx_lpc_enable_resources(device_t dev)
+{
+       pci_dev_enable_resources(dev);
+       enable_childrens_resources(dev);
+}
+
+static struct device_operations lpc_ops = {
+       .read_resources         = i82801bx_lpc_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = i82801bx_lpc_enable_resources,
+       .init                   = lpc_init,
+       .scan_bus               = scan_static_bus,
+       .enable                 = i82801bx_enable,
+};
+
+static const struct pci_driver i82801aa_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2410,
+};
+
+static const struct pci_driver i82801ab_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2420,
+};
+
+static const struct pci_driver i82801ba_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2440,
+};
+
+static const struct pci_driver i82801ca_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2480,
+};
+
+static const struct pci_driver i82801db_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24c0,
+};
+
+static const struct pci_driver i82801dbm_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cc,
+};
+
+/* 82801EB and 82801ER */
+static const struct pci_driver i82801ex_lpc __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24d0,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_nic.c b/src/southbridge/intel/i82801bx/i82801bx_nic.c
new file mode 100644 (file)
index 0000000..3728d28
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with a NIC. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+
+static struct device_operations nic_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = 0,
+};
+
+/* Note: There's no NIC on 82801AA/AB (ICH/ICH0). */
+
+/* 82801BA/BAM/CA/CAM (ICH2/ICH2-M/ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ba_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_LAN,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_LAN,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_LAN,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_nic __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_LAN,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_nic1 __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_LAN1,
+};
+
+static const struct pci_driver i82801e_nic2 __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_LAN2,
+};
+
diff --git a/src/southbridge/intel/i82801bx/i82801bx_pci.c b/src/southbridge/intel/i82801bx/i82801bx_pci.c
new file mode 100644 (file)
index 0000000..1f01e5d
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+
+static void pci_init(struct device *dev)
+{
+       uint16_t reg16;
+
+       /* Clear system errors */
+       reg16 = pci_read_config16(dev, 0x06);
+       reg16 |= 0xf900;        /* Clear possible errors */
+       pci_write_config16(dev, 0x06, reg16);
+
+       reg16 = pci_read_config16(dev, 0x1e);
+       reg16 |= 0xf800;        /* Clear possible errors */
+       pci_write_config16(dev, 0x1e, reg16);
+}
+
+static struct device_operations pci_ops = {
+       .read_resources         = pci_bus_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_bus_enable_resources,
+       .init                   = pci_init,
+       .scan_bus               = pci_scan_bridge,
+};
+
+static const struct pci_driver i82801aa_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2418,
+};
+
+static const struct pci_driver i82801ab_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2428,
+};
+
+/* 82801BA, 82801CA, 82801DB, 82801EB, and 82801ER */
+static const struct pci_driver i82801misc_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x244e,
+};
+
+static const struct pci_driver i82801dbm_pci __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x2448,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_reset.c b/src/southbridge/intel/i82801bx/i82801bx_reset.c
new file mode 100644 (file)
index 0000000..239a727
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2002 Eric Biederman <ebiederm@xmission.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <arch/io.h>
+
+void hard_reset(void)
+{
+       /* Try rebooting through port 0xcf9. */
+       outb((1 << 2) | (1 << 1), 0xcf9);
+}
diff --git a/src/southbridge/intel/i82801bx/i82801bx_sata.c b/src/southbridge/intel/i82801bx/i82801bx_sata.c
new file mode 100644 (file)
index 0000000..19a892a
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801bx.h"
+
+/* TODO: Set dynamically, if the user only wants one SATA channel or none
+ * at all.
+ */
+static void sata_init(struct device *dev)
+{
+       /* SATA configuration */
+       pci_write_config8(dev, 0x04, 0x07);
+       pci_write_config8(dev, 0x09, 0x8f);
+
+       /* Set timmings */
+       pci_write_config16(dev, 0x40, 0x0a307);
+       pci_write_config16(dev, 0x42, 0x0a307);
+
+       /* Sync DMA */
+       pci_write_config16(dev, 0x48, 0x000f);
+       pci_write_config16(dev, 0x4a, 0x1111);
+
+       /* 66 MHz */
+       pci_write_config16(dev, 0x54, 0xf00f);
+
+       /* Combine IDE - SATA configuration */
+       pci_write_config8(dev, 0x90, 0x0);
+
+       /* Port 0 & 1 enable */
+       pci_write_config8(dev, 0x92, 0x33);
+
+       /* Initialize SATA. */
+       pci_write_config16(dev, 0xa0, 0x0018);
+       pci_write_config32(dev, 0xa4, 0x00000264);
+       pci_write_config16(dev, 0xa0, 0x0040);
+       pci_write_config32(dev, 0xa4, 0x00220043);
+}
+
+static struct device_operations sata_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = sata_init,
+       .scan_bus               = 0,
+       .enable                 = i82801bx_enable,
+};
+
+/* 82801EB */
+static const struct pci_driver i82801eb_sata_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24d1,
+};
+
+/* 82801ER */
+static const struct pci_driver i82801er_sata_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24df,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_smbus.c b/src/southbridge/intel/i82801bx/i82801bx_smbus.c
new file mode 100644 (file)
index 0000000..8a5476f
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* TODO: Check datasheets if this will work for all ICH* southbridges. */
+
+#include <stdint.h>
+#include <smbus.h>
+#include <pci.h>
+#include <arch/io.h>
+#include "i82801bx.h"
+#include "i82801_smbus.h"
+
+static int smbus_read_byte(struct bus *bus, device_t dev, u8 address)
+{
+       unsigned device;        /* TODO: u16? */
+       struct resource *res;
+
+       device = dev->path.i2c.device;
+       res = find_resource(bus->dev, 0x20);
+
+       return do_smbus_read_byte(res->base, device, address);
+}
+
+static struct smbus_bus_operations lops_smbus_bus = {
+       .read_byte      = smbus_read_byte,
+};
+
+static const struct device_operations smbus_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = 0,
+       .scan_bus               = scan_static_bus,
+       .enable                 = i82801er_enable,
+       .ops_smbus_bus          = &lops_smbus_bus,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_SMB,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_SMB,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_SMB,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_SMB,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_SMB,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_SMB,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_SMB,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_smb __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_SMB,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_smbus.h b/src/southbridge/intel/i82801bx/i82801bx_smbus.h
new file mode 100644 (file)
index 0000000..7a78508
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <device/smbus_def.h>
+
+static void smbus_delay(void)
+{
+       inb(0x80);
+}
+
+static int smbus_wait_until_ready(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while (byte & 1);
+       return loops ? 0 : -1;
+}
+
+static int smbus_wait_until_done(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while ((byte & 1) || (byte & ~((1 << 6) | (1 << 0))) == 0);
+       return loops ? 0 : -1;
+}
+
+static int smbus_wait_until_blk_done(void)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       } while ((byte & (1 << 7)) == 0);
+       return loops ? 0 : -1;
+}
+
+static int do_smbus_read_byte(unsigned device, unsigned address)
+{
+       unsigned char global_status_register;
+       unsigned char byte;
+
+       if (smbus_wait_until_ready() < 0) {
+               return SMBUS_WAIT_UNTIL_READY_TIMEOUT;
+       }
+       /* Setup transaction */
+       /* Disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+       /* Set the device I'm talking too */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
+       /* Set the command/address... */
+       outb(address & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
+       /* Set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2 << 2),
+            (SMBUS_IO_BASE + SMBHSTCTL));
+       /* Clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* Clear the data byte... */
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* Start the command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40),
+            SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Poll for transaction completion */
+       if (smbus_wait_until_done() < 0) {
+               return SMBUS_WAIT_UNTIL_DONE_TIMEOUT;
+       }
+
+       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* Ignore the "In Use" status... */
+       global_status_register &= ~(3 << 5);
+
+       /* Read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+       if (global_status_register != (1 << 1)) {
+               return SMBUS_ERROR;
+       }
+       return byte;
+}
+
+/* This function is neither used nor tested by me (Corey Osgood), the author 
+(Yinghai) probably tested/used it on i82801er */
+static int do_smbus_write_block(unsigned device, unsigned length, unsigned cmd,
+                               unsigned data1, unsigned data2)
+{
+#warning "do_smbus_write_block is commented out"
+       print_err("Untested smbus_write_block called\r\n");
+#if 0
+       unsigned char global_control_register;
+       unsigned char global_status_register;
+       unsigned char byte;
+       unsigned char stat;
+       int i;
+
+       /* Clear the PM timeout flags, SECOND_TO_STS */
+       outw(inw(0x0400 + 0x66), 0x0400 + 0x66);
+
+       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
+               return -2;
+       }
+
+       /* Setup transaction */
+       /* Obtain ownership */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+       for (stat = 0; (stat & 0x40) == 0;) {
+               stat = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+       /* Clear the done bit */
+       outb(0x80, SMBUS_IO_BASE + SMBHSTSTAT);
+       /* Disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* Set the device I'm talking too */
+       outb(((device & 0x7f) << 1), SMBUS_IO_BASE + SMBXMITADD);
+
+       /* Set the command address */
+       outb(cmd & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
+
+       /* Set the block length */
+       outb(length & 0xff, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* Try sending out the first byte of data here */
+       byte = (data1 >> (0)) & 0x0ff;
+       outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
+       /* Issue a block write command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x5 << 2) | 0x40,
+            SMBUS_IO_BASE + SMBHSTCTL);
+
+       for (i = 0; i < length; i++) {
+
+               /* Poll for transaction completion */
+               if (smbus_wait_until_blk_done(SMBUS_IO_BASE) < 0) {
+                       return -3;
+               }
+
+               /* Load the next byte */
+               if (i > 3)
+                       byte = (data2 >> (i % 4)) & 0x0ff;
+               else
+                       byte = (data1 >> (i)) & 0x0ff;
+               outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
+
+               /* Clear the done bit */
+               outb(inb(SMBUS_IO_BASE + SMBHSTSTAT),
+                    SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+
+       print_debug("SMBUS Block complete\r\n");
+       return 0;
+#endif
+}
diff --git a/src/southbridge/intel/i82801bx/i82801bx_usb.c b/src/southbridge/intel/i82801bx/i82801bx_usb.c
new file mode 100644 (file)
index 0000000..721f5bf
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ */
+
+/* This code should work for all ICH* southbridges with USB. */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801bx.h"
+
+static void usb_init(struct device *dev)
+{
+       /* TODO: Any init needed? Some ports have it, others don't. */
+}
+
+static struct device_operations usb_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = usb_init,
+       .scan_bus               = 0,
+       .enable                 = i82801bx_enable,
+};
+
+/* 82801AA (ICH) */
+static const struct pci_driver i82801aa_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AA_USB,
+};
+
+/* 82801AB (ICH0) */
+static const struct pci_driver i82801ab_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801AB_USB,
+};
+
+/* 82801BA/BAM (ICH2/ICH2-M) */
+static const struct pci_driver i82801ba_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_USB1,
+};
+
+static const struct pci_driver i82801ba_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801BA_USB2,
+};
+
+/* 82801CA/CAM (ICH3-S/ICH3-M) */
+static const struct pci_driver i82801ca_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB1,
+};
+
+static const struct pci_driver i82801ca_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB2,
+};
+
+static const struct pci_driver i82801ca_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB3,
+};
+
+/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
+static const struct pci_driver i82801db_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB1,
+};
+
+static const struct pci_driver i82801db_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB2,
+};
+
+static const struct pci_driver i82801db_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DB_USB3,
+};
+
+/* 82801EB/ER (ICH5/ICH5R) */
+static const struct pci_driver i82801eb_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB1,
+};
+
+static const struct pci_driver i82801eb_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB2,
+};
+
+static const struct pci_driver i82801eb_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB3,
+};
+
+static const struct pci_driver i82801eb_usb4 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_USB4,
+};
+
+/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
+static const struct pci_driver i82801fb_usb1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB1,
+};
+
+static const struct pci_driver i82801fb_usb2 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB2,
+};
+
+static const struct pci_driver i82801fb_usb3 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB3,
+};
+
+static const struct pci_driver i82801fb_usb4 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801FB_USB4,
+};
+
+/* 82801E (C-ICH) */
+static const struct pci_driver i82801e_usb __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801E_USB,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_usb_ehci.c b/src/southbridge/intel/i82801bx/i82801bx_usb_ehci.c
new file mode 100644 (file)
index 0000000..1e885e9
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Tyan Computer
+ * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801bx.h"
+
+static void usb_ehci_init(struct device *dev)
+{
+       /* TODO: Is any special init really needed? */
+       uint32_t cmd;
+
+       printk_debug("EHCI: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
+
+       printk_debug("done.\n");
+}
+
+static void usb_ehci_set_subsystem(device_t dev, unsigned vendor,
+                                  unsigned device)
+{
+       uint8_t access_cntl;
+
+       access_cntl = pci_read_config8(dev, 0x80);
+
+       /* Enable writes to protected registers. */
+       pci_write_config8(dev, 0x80, access_cntl | 1);
+
+       /* Write the subsystem vendor and device ID. */
+       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
+                          ((device & 0xffff) << 16) | (vendor & 0xffff));
+
+       /* Restore protection. */
+       pci_write_config8(dev, 0x80, access_cntl);
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem  = &usb_ehci_set_subsystem,
+};
+
+static struct device_operations usb_ehci_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .init                   = usb_ehci_init,
+       .scan_bus               = 0,
+       .enable                 = i82801bx_enable,
+       .ops_pci                = &lops_pci,
+};
+
+/* 82801DB and 82801DBM */
+static const struct pci_driver i82801db_usb_ehci __pci_driver = {
+       .ops    = &usb_ehci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24cd,
+};
+
+/* 82801EB and 82801ER */
+static const struct pci_driver i82801ex_usb_ehci __pci_driver = {
+       .ops    = &usb_ehci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x24dd,
+};
diff --git a/src/southbridge/intel/i82801bx/i82801bx_watchdog.c b/src/southbridge/intel/i82801bx/i82801bx_watchdog.c
new file mode 100644 (file)
index 0000000..aea10e1
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2006 John Dufresne <jon.dufresne@gmail.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <console/console.h>
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pci.h>
+
+/* TODO: I'm fairly sure the same functionality is provided elsewhere. */
+
+void watchdog_off(void)
+{
+       device_t dev;
+       unsigned long value, base;
+
+       /* Turn off the ICH5 watchdog. */
+       dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0));
+
+       /* Enable I/O space. */
+       value = pci_read_config16(dev, 0x04);
+       value |= (1 << 10);
+       pci_write_config16(dev, 0x04, value);
+
+       /* Get TCO base. */
+       base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
+
+       /* Disable the watchdog timer. */
+       value = inw(base + 0x08);
+       value |= 1 << 11;
+       outw(value, base + 0x08);
+
+       /* Clear TCO timeout status. */
+       outw(0x0008, base + 0x04);
+       outw(0x0002, base + 0x06);
+
+       printk_debug("ICH Watchdog disabled\r\n");
+}
diff --git a/src/southbridge/intel/i82801ca/Kconfig b/src/southbridge/intel/i82801ca/Kconfig
deleted file mode 100644 (file)
index c5404e9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-config SOUTHBRIDGE_INTEL_I82801CA
-       bool
diff --git a/src/southbridge/intel/i82801ca/Makefile.inc b/src/southbridge/intel/i82801ca/Makefile.inc
deleted file mode 100644 (file)
index 587b067..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-driver-y += i82801ca.o
-driver-y += i82801ca_usb.o
-driver-y += i82801ca_lpc.o
-driver-y += i82801ca_ide.o
-driver-y += i82801ca_ac97.o
-#driver-y += i82801ca_nic.o
-driver-y += i82801ca_pci.o
-obj-y += i82801ca_reset.o
diff --git a/src/southbridge/intel/i82801ca/chip.h b/src/southbridge/intel/i82801ca/chip.h
deleted file mode 100644 (file)
index f9583ca..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef I82801CA_CHIP_H
-#define I82801CA_CHIP_H
-
-struct southbridge_intel_i82801ca_config 
-{
-};
-extern struct chip_operations southbridge_intel_i82801ca_ops;
-
-#endif /* I82801CA_CHIP_H */
diff --git a/src/southbridge/intel/i82801ca/cmos_failover.c b/src/southbridge/intel/i82801ca/cmos_failover.c
deleted file mode 100644 (file)
index bf35764..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-//kind of cmos_err for ich3
-
-#include "i82801ca.h"
-
-static void check_cmos_failed(void) 
-{
-#if CONFIG_HAVE_OPTION_TABLE
-       uint8_t byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
-
-       if( byte & RTC_BATTERY_DEAD) {
-               // Set boot_option and last_boot to 'Fallback',
-               // clear reboot_bits
-        byte = cmos_read(RTC_BOOT_BYTE);
-        byte &= 0x0c;
-        byte |= CONFIG_MAX_REBOOT_CNT << 4;
-        cmos_write(byte, RTC_BOOT_BYTE);
-    }
-#endif
-}
diff --git a/src/southbridge/intel/i82801ca/i82801ca.c b/src/southbridge/intel/i82801ca/i82801ca.c
deleted file mode 100644 (file)
index 23a64f7..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <assert.h>
-#include "i82801ca.h"
-
-void i82801ca_enable(device_t dev)
-{
-       unsigned int index = 0;
-       uint8_t bHasDisableBit = 0;
-       uint16_t cur_disable_mask, new_disable_mask;
-
-//     all 82801ca devices are in bus 0
-       unsigned int devfn = PCI_DEVFN(0x1f, 0); // lpc
-       device_t lpc_dev = dev_find_slot(0, devfn); // 0
-       if (!lpc_dev)
-               return;
-
-       // Calculate disable bit position for specified device:function
-       // NOTE: For ICH-3, only the following devices can be disabled:
-       //               D31:F1, D31:F3, D31:F5, D31:F6, 
-       //               D29:F0, D29:F1, D29:F2
-
-    if (PCI_SLOT(dev->path.pci.devfn) == 31) {
-       index = PCI_FUNC(dev->path.pci.devfn);
-
-               if ((index == 1) || (index == 3) || (index == 5) || (index == 6))
-                       bHasDisableBit = 1;
-
-    } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
-       index = 8 + PCI_FUNC(dev->path.pci.devfn);
-
-               if (PCI_FUNC(dev->path.pci.devfn) < 3)
-                       bHasDisableBit = 1;
-    }
-
-       if (bHasDisableBit) {
-               cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
-               new_disable_mask = cur_disable_mask & ~(1<<index);              // enable it
-               if (!dev->enabled) {
-                       new_disable_mask |= (1<<index);  // disable it
-               }
-               if (new_disable_mask != cur_disable_mask) {
-                       pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
-               }
-       }
-}
-
-struct chip_operations southbridge_intel_i82801ca_ops = {
-       CHIP_NAME("Intel 82801CA Southbridge")
-       .enable_dev = i82801ca_enable,
-};
diff --git a/src/southbridge/intel/i82801ca/i82801ca.h b/src/southbridge/intel/i82801ca/i82801ca.h
deleted file mode 100644 (file)
index a761056..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef I82801CA_H
-#define I82801CA_H
-
-#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
-#include "chip.h"
-extern void i82801ca_enable(device_t dev);
-#endif
-
-
-#define PCI_DMA_CFG     0x90
-#define SERIRQ_CNTL     0x64
-#define GEN_CNTL        0xd0
-#define GEN_STS         0xd4
-#define RTC_CONF        0xd8
-#define GEN_PMCON_3     0xa4
-
-#define PMBASE          0x40
-#define ACPI_CNTL       0x44
-#define BIOS_CNTL       0x4E
-#define GPIO_BASE       0x58
-#define GPIO_CNTL       0x5C
-#define PIRQA_ROUT      0x60
-#define PIRQE_ROUT      0x68
-#define COM_DEC         0xE0
-#define LPC_EN          0xE6
-#define FUNC_DIS        0xF2
-
-// GEN_PMCON_3 bits
-#define RTC_BATTERY_DEAD               (1<<2)
-#define RTC_POWER_FAILED               (1<<1)
-#define SLEEP_AFTER_POWER_FAIL (1<<0)
-
-/********************************************************************/
-/*                                                     IDE Controller                          */
-/********************************************************************/
-
-// PCI Configuration Space (D31:F1)
-#define IDE_TIM_PRI            0x40            // IDE timings, primary
-#define IDE_TIM_SEC            0x42            // IDE timings, secondary
-
-
-// IDE_TIM bits
-#define IDE_DECODE_ENABLE      (1<<15)
-
-/********************************************************************/
-/*                                                             SMBus                               */
-/********************************************************************/
-
-// PCI Configuration Space (D31:F3)
-#define SMB_BASE       0x20
-#define HOSTC          0x40
-
-// HOSTC bits
-#define I2C_EN         (1<<2)
-#define SMB_SMI_EN     (1<<1)
-#define HST_EN         (1<<0)
-
-#define SMBUS_IO_BASE 0x1000
-
-// I/O registers (relative to SMBUS_IO_BASE)
-#define SMBHSTSTAT             0
-#define SMBHSTCTL              2
-#define SMBHSTCMD              3
-#define SMBXMITADD             4
-#define SMBHSTDAT0             5
-#define SMBHSTDAT1             6
-#define SMBBLKDAT              7
-#define SMBTRNSADD             9
-#define SMBSLVDATA             10
-#define SMLINK_PIN_CTL 14
-#define SMBUS_PIN_CTL  15 
-
-/* Between 1-10 seconds, We should never timeout normally 
- * Longer than this is just painful when a timeout condition occurs.
- */
-#define SMBUS_TIMEOUT (100*1000)
-
-#endif /* I82801CA_H */
diff --git a/src/southbridge/intel/i82801ca/i82801ca_ac97.c b/src/southbridge/intel/i82801ca/i82801ca_ac97.c
deleted file mode 100644 (file)
index 7e03cc3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * (C) 2003 Linux Networx
- */
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801ca.h"
-
-
-static struct device_operations ac97audio_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable           = i82801ca_enable,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver ac97audio_driver __pci_driver = {
-       .ops    = &ac97audio_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_AUDIO,
-};
-
-
-static struct device_operations ac97modem_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable           = i82801ca_enable,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver ac97modem_driver __pci_driver = {
-       .ops    = &ac97modem_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_MODEM,
-};
diff --git a/src/southbridge/intel/i82801ca/i82801ca_early_smbus.c b/src/southbridge/intel/i82801ca/i82801ca_early_smbus.c
deleted file mode 100644 (file)
index d33e404..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#include <device/pci_ids.h>
-#include "i82801ca.h"
-
-static void enable_smbus(void)
-{
-       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
-
-       print_debug("SMBus controller enabled\r\n");
-       /* set smbus iobase */
-       pci_write_config32(dev, SMB_BASE, SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
-       /* Set smbus enable */
-       pci_write_config8(dev, HOSTC, HST_EN);
-       /* Set smbus iospace enable */ 
-       pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
-       /* Disable interrupt generation */ 
-       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-}
-
-
-static inline void smbus_delay(void)
-{
-       outb(0x80, 0x80);
-}
-
-// See http://www.coreboot.org/pipermail/linuxbios/2004-September/009077.html
-// for a description of this function.
-static int smbus_wait_until_active(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               if ((val & 1)) {
-                       break;
-               }
-       } while (--loops);
-       return loops ? 0 : -4;
-}
-
-static int smbus_wait_until_ready(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               // !HOST_BUSY?
-               if ((val & 1) == 0) {
-                       break;
-               }
-               if(loops == (SMBUS_TIMEOUT / 2)) {
-                       // Clear status flags
-                       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
-                               SMBUS_IO_BASE + SMBHSTSTAT);
-               }
-       } while(--loops);
-       return loops?0:-2;
-}
-
-static int smbus_wait_until_done(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               // !HOST_BUSY?
-               if ( (val & 1) == 0) {
-                       break;
-               }
-               // BYTE_DONE or SUCCESS or error?
-               if ((val & ~((1<<6)|(1<<0)) ) != 0 ) {
-                       break;
-               }
-       } while(--loops);
-       return loops?0:-3;
-}
-
-static int smbus_read_byte(unsigned device, unsigned address)
-{
-       unsigned char global_control_register;
-       unsigned char global_status_register;
-       unsigned char byte;
-
-       if (smbus_wait_until_ready() < 0) {
-               return -2;
-       }
-       
-       /* setup transaction */
-       /* disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xfe, SMBUS_IO_BASE + SMBHSTCTL);
-       /* set to read from the specified device  */
-       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
-       /* set the command/address... */
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       /* set up for a byte data read */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2<<2), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* clear the data byte...*/
-       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* start a byte read, with interrupts disabled */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
-       /* poll for it to start */
-       if (smbus_wait_until_active() < 0) {
-               return -4;
-       }
-
-       /* poll for transaction completion */
-       if (smbus_wait_until_done() < 0) {
-               return -3;
-       }
-
-       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT) & ~(1<<6); /* Ignore the In Use Status... */
-
-       /* read results of transaction */
-       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
-
-       // SUCCESS?
-       if (global_status_register != 2) {
-               return -1;
-       }
-       return byte;
-}
diff --git a/src/southbridge/intel/i82801ca/i82801ca_ide.c b/src/southbridge/intel/i82801ca/i82801ca_ide.c
deleted file mode 100644 (file)
index d1a19c7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801ca.h"
-
-
-static void ide_init(struct device *dev)
-{
-       /* Enable ide devices so the linux ide driver will work */
-       uint16_t ideTimingConfig;
-       int enable_primary = 1;
-       int enable_secondary = 1;
-
-       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
-       ideTimingConfig &= ~IDE_DECODE_ENABLE;
-       if (enable_primary) {
-               /* Enable first ide interface */
-               ideTimingConfig |= IDE_DECODE_ENABLE;
-               printk_debug("IDE0 ");
-       }
-       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
-
-    ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
-    ideTimingConfig &= ~IDE_DECODE_ENABLE;
-    if (enable_secondary) {
-               /* Enable secondary ide interface */
-        ideTimingConfig |= IDE_DECODE_ENABLE;
-        printk_debug("IDE1 ");
-       }
-    pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
-}
-
-static struct device_operations ide_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = ide_init,
-       .scan_bus         = 0,
-       .enable           = i82801ca_enable,
-};
-
-static const struct pci_driver ide_driver __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_IDE,
-};
diff --git a/src/southbridge/intel/i82801ca/i82801ca_lpc.c b/src/southbridge/intel/i82801ca/i82801ca_lpc.c
deleted file mode 100644 (file)
index fd16fef..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * (C) 2003 Linux Networx, SuSE Linux AG
- * (C) 2004 Tyan Computer
- * (c) 2005 Digital Design Corporation
- */
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <pc80/mc146818rtc.h>
-#include <pc80/isa-dma.h>
-#include <arch/io.h>
-#include "i82801ca.h"
-
-#define NMI_OFF 0
-
-#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
-#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
-#endif
-
-#define MAINBOARD_POWER_OFF 0
-#define MAINBOARD_POWER_ON  1
-
-
-void i82801ca_enable_ioapic( struct device *dev) 
-{
-       uint32_t dword;
-    volatile uint32_t* ioapic_index = (volatile uint32_t*)0xfec00000;
-    volatile uint32_t* ioapic_data = (volatile uint32_t*)0xfec00010;
-
-    dword = pci_read_config32(dev, GEN_CNTL);
-    dword |= (3 << 7); /* enable ioapic & disable SMBus interrupts */
-    dword |= (1 <<13); /* coprocessor error enable */
-    dword |= (1 << 1); /* delay transaction enable */
-    dword |= (1 << 2); /* DMA collection buf enable */
-    pci_write_config32(dev, GEN_CNTL, dword);
-    printk_debug("ioapic southbridge enabled %x\n",dword);
-        
-    // Must program the APIC's ID before using it
-
-    *ioapic_index = 0;         // Select APIC ID register
-    *ioapic_data = (2<<24);
-        
-    // Hang if the ID didn't take (chip not present?)
-    *ioapic_index = 0;
-    dword = *ioapic_data;
-    printk_debug("Southbridge apic id = %x\n", (dword>>24) & 0xF);
-    if(dword != (2<<24))
-               die("");
-
-       *ioapic_index = 3;              // Select Boot Configuration register
-       *ioapic_data = 1;               // Use Processor System Bus to deliver interrupts
-}
-
-// This is how interrupts are received from the Super I/O chip
-void i82801ca_enable_serial_irqs( struct device *dev)
-{
-       // Recognize serial IRQs, continuous mode, frame size 21, 4 clock start frame pulse width
-    pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0<< 0));
-}
-
-//----------------------------------------------------------------------------------
-// Function:           i82801ca_lpc_route_dma
-// Parameters:         dev
-//                                     mask - identifies whether each channel should be used for PCI DMA
-//                                                (bit = 0) or LPC DMA (bit = 1). The LSb controls channel 0.
-//                                                Channel 4 is not used (reserved). 
-// Return Value:       None
-// Description:        Route all DMA channels to either PCI or LPC.
-//
-void i82801ca_lpc_route_dma( struct device *dev, uint8_t mask) 
-{
-    uint16_t dmaConfig;
-    int channelIndex;
-
-    dmaConfig = pci_read_config16(dev, PCI_DMA_CFG);
-    dmaConfig &= 0x300;                                // Preserve reserved bits
-    for(channelIndex = 0; channelIndex < 8; channelIndex++) {
-       if (channelIndex == 4)
-               continue;               // Register doesn't support channel 4
-        dmaConfig |= ((mask & (1 << channelIndex))? 3:1) << (channelIndex*2);
-    }
-    pci_write_config16(dev, PCI_DMA_CFG, dmaConfig);
-}
-
-void i82801ca_rtc_init(struct device *dev)
-{
-    uint32_t dword;
-    int rtc_failed;
-       int pwr_on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
-    uint8_t pmcon3 = pci_read_config8(dev, GEN_PMCON_3);
-
-    rtc_failed = pmcon3 & RTC_BATTERY_DEAD;
-    if (rtc_failed) {
-       // Clear the RTC_BATTERY_DEAD bit, but preserve
-        // the RTC_POWER_FAILED, G3 state, and reserved bits
-               // NOTE: RTC_BATTERY_DEAD and RTC_POWER_FAILED are "write-1-clear" bits
-        pmcon3 &= ~RTC_POWER_FAILED;
-    }
-
-    get_option(&pwr_on, "power_on_after_fail");
-       pmcon3 &= ~SLEEP_AFTER_POWER_FAIL;
-       if (!pwr_on) {
-               pmcon3 |= SLEEP_AFTER_POWER_FAIL;
-       }
-       pci_write_config8(dev, GEN_PMCON_3, pmcon3);
-       printk_info("set power %s after power fail\n", 
-                                pwr_on ? "on" : "off");
-
-    // See if the Safe Mode jumper is set
-    dword = pci_read_config32(dev, GEN_STS);
-    rtc_failed |= dword & (1 << 2);
-        
-    rtc_init(rtc_failed);
-}
-
-
-void i82801ca_1f0_misc(struct device *dev)
-{
-       // Prevent LPC disabling, enable parity errors, and SERR# (System Error)
-    pci_write_config16(dev, PCI_COMMAND, 0x014f);
-        
-    // Set ACPI base address to 0x1100 (I/O space)
-    pci_write_config32(dev, PMBASE, 0x00001101);
-        
-    // Enable ACPI I/O and power management
-    pci_write_config8(dev, ACPI_CNTL, 0x10);
-        
-    // Set GPIO base address to 0x1180 (I/O space)
-    pci_write_config32(dev, GPIO_BASE, 0x00001181);
-        
-    // Enable GPIO
-    pci_write_config8(dev, GPIO_CNTL, 0x10);
-        
-    // Route PIRQA to IRQ11, PIRQB to IRQ3, PIRQC to IRQ5, PIRQD to IRQ10
-    pci_write_config32(dev, PIRQA_ROUT, 0x0A05030B);
-        
-    // Route PIRQE to IRQ7. Leave PIRQF - PIRQH unrouted.
-    pci_write_config8(dev, PIRQE_ROUT, 0x07);
-        
-    // Enable access to the upper 128 byte bank of CMOS RAM
-    pci_write_config8(dev, RTC_CONF, 0x04);
-        
-    // Decode 0x3F8-0x3FF (COM1) for COMA port,
-       //                0x2F8-0x2FF (COM2) for COMB
-    pci_write_config8(dev, COM_DEC, 0x10);
-
-       // LPT decode defaults to 0x378-0x37F and 0x778-0x77F
-       // Floppy decode defaults to 0x3F0-0x3F5, 0x3F7
-
-    // Enable COMA, COMB, LPT, floppy; 
-       // disable microcontroller, Super I/O, sound, gameport
-    pci_write_config16(dev, LPC_EN, 0x000F);
-}
-
-static void lpc_init(struct device *dev)
-{
-       uint8_t byte;
-       int pwr_on=-1;
-       int nmi_option;
-
-       /* IO APIC initialization */
-       i82801ca_enable_ioapic(dev);
-
-       i82801ca_enable_serial_irqs(dev);
-       
-       /* power after power fail */
-               /* FIXME this doesn't work! */
-        /* Which state do we want to goto after g3 (power restored)?
-         * 0 == S0 Full On
-         * 1 == S5 Soft Off
-         */
-    byte = pci_read_config8(dev, GEN_PMCON_3);
-    if (pwr_on)
-       byte &= ~1;             // Return to S0 (boot) after power is re-applied
-    else
-       byte |= 1;              // Return to S5
-    pci_write_config8(dev, GEN_PMCON_3, byte);
-    printk_info("set power %s after power fail\n", pwr_on?"on":"off");
-
-    /* Set up NMI on errors */
-    byte = inb(0x61);
-    byte &= ~(1 << 3); /* IOCHK# NMI Enable */
-    byte &= ~(1 << 2); /* PCI SERR# Enable */
-    outb(byte, 0x61);
-    byte = inb(0x70);
-    nmi_option = NMI_OFF;
-    get_option(&nmi_option, "nmi");
-    if (nmi_option) {                  
-        byte &= ~(1 << 7); /* set NMI */
-        outb(byte, 0x70);
-    }
-       
-       /* Initialize the real time clock */
-       i82801ca_rtc_init(dev);
-
-       i82801ca_lpc_route_dma(dev, 0xff);
-
-       /* Initialize isa dma */
-       isa_dma_init();
-
-       i82801ca_1f0_misc(dev);
-}
-
-static void i82801ca_lpc_read_resources(device_t dev)
-{
-       struct resource *res;
-
-       /* Get the normal PCI resources of this device. */
-       pci_dev_read_resources(dev);
-
-       /* Add an extra subtractive resource for both memory and I/O. */
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
-       res->base = 0;
-       res->size = 0x1000;
-       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
-       res->base = 0xff800000;
-       res->size = 0x00800000; /* 8 MB for flash */
-       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, 3); /* IOAPIC */
-       res->base = 0xfec00000;
-       res->size = 0x00001000;
-       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-}
-
-static void i82801ca_lpc_enable_resources(device_t dev)
-{
-       pci_dev_enable_resources(dev);
-       enable_childrens_resources(dev);
-}
-
-static struct device_operations lpc_ops  = {
-       .read_resources   = i82801ca_lpc_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = i82801ca_lpc_enable_resources,
-       .init             = lpc_init,
-       .scan_bus         = scan_static_bus,
-       .enable           = 0,
-};
-
-static const struct pci_driver lpc_driver __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_LPC,
-};
diff --git a/src/southbridge/intel/i82801ca/i82801ca_nic.c b/src/southbridge/intel/i82801ca/i82801ca_nic.c
deleted file mode 100644 (file)
index c0b01bc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801ca.h"
-
-
-static struct device_operations nic_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver nic_driver __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_LAN,
-};
diff --git a/src/southbridge/intel/i82801ca/i82801ca_pci.c b/src/southbridge/intel/i82801ca/i82801ca_pci.c
deleted file mode 100644 (file)
index 5f7b897..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801ca.h"
-
-static void pci_init(struct device *dev)
-{
-       // NOTE: the original (v1) 'CA code set these in the bridge register (0x3E-3F)
-       /* Enable pci error detecting */
-       uint32_t dword = pci_read_config32(dev, PCI_COMMAND);
-       dword |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
-       pci_write_config32(dev, PCI_COMMAND, dword);
-}
-
-static struct device_operations pci_ops  = {
-       .read_resources   = pci_bus_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_bus_enable_resources,
-       .init             = pci_init,
-       .scan_bus         = pci_scan_bridge,
-};
-
-static const struct pci_driver pci_driver __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_PCI,
-};
-
diff --git a/src/southbridge/intel/i82801ca/i82801ca_reset.c b/src/southbridge/intel/i82801ca/i82801ca_reset.c
deleted file mode 100644 (file)
index 93ef6d9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <arch/io.h>
-
-void i82801ca_hard_reset(void)
-{
-        /* Try rebooting through port 0xcf9 */
-        // Hard reset without power cycle
-        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
-}
diff --git a/src/southbridge/intel/i82801ca/i82801ca_smbus.c b/src/southbridge/intel/i82801ca/i82801ca_smbus.c
deleted file mode 100644 (file)
index 0eceba7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <smbus.h>
-#include <pci.h>
-#include <arch/io.h>
-#include "i82801ca.h"
-
-#define PM_BUS 0
-#define PM_DEVFN PCI_DEVFN(0x1f,3)
-
-void smbus_enable(void)
-{
-       /* iobase addr */
-       pcibios_write_config_dword(PM_BUS, PM_DEVFN, SMB_BASE, 
-                                                          SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
-       /* smbus enable */
-       pcibios_write_config_byte(PM_BUS, PM_DEVFN, HOSTC, HST_EN);
-       /* iospace enable */
-       pcibios_write_config_word(PM_BUS, PM_DEVFN, PCI_COMMAND, PCI_COMMAND_IO);
-
-    /* Disable interrupt generation */
-    outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-}
-
-static void smbus_wait_until_ready(void)
-{
-       // Loop while HOST_BUSY
-       while((inb(SMBUS_IO_BASE + SMBHSTSTAT) & 1) == 1) {
-               /* nop */
-       }
-}
-
-static void smbus_wait_until_done(void)
-{
-       unsigned char byte;
-       
-       // Loop while HOST_BUSY
-       do {
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-       while((byte &1) == 1);
-       
-       // Wait for SUCCESS or error or BYTE_DONE
-       while( (byte & ~1) == 0) {
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-}
-
-int smbus_read_byte(unsigned device, unsigned address, unsigned char *result)
-{
-       unsigned char host_status_register;
-       unsigned char byte;
-
-       smbus_wait_until_ready();
-
-       /* setup transaction */
-       /* disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
-       /* set to read from the specified device  */
-       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADD);
-       /* set the command/address... */
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       /* set up for a byte data read */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x2 << 2), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* clear the data byte...*/
-       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* start the command */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* poll for transaction completion */
-       smbus_wait_until_done();
-
-       host_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* read results of transaction */
-       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
-
-       *result = byte;
-       return host_status_register != 0x02;            // return true if !SUCCESS
-}
diff --git a/src/southbridge/intel/i82801ca/i82801ca_usb.c b/src/southbridge/intel/i82801ca/i82801ca_usb.c
deleted file mode 100644 (file)
index 7e7c058..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801ca.h"
-
-static void usb_init(struct device *dev)
-{
-
-#if 0
-       uint32_t cmd;
-       printk_debug("USB: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, 
-               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
-               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
-
-
-       printk_debug("done.\n");
-#endif
-
-}
-
-static struct device_operations usb_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = usb_init,
-       .scan_bus         = 0,
-       .enable           = i82801ca_enable,
-};
-
-static const struct pci_driver usb_driver_1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_USB1,
-};
-static const struct pci_driver usb_driver_2 __pci_driver = {
-        .ops    = &usb_ops,
-        .vendor = PCI_VENDOR_ID_INTEL,
-        .device = PCI_DEVICE_ID_INTEL_82801CA_USB2,
-};
-static const struct pci_driver usb_driver_3 __pci_driver = {
-        .ops    = &usb_ops,
-        .vendor = PCI_VENDOR_ID_INTEL,
-        .device = PCI_DEVICE_ID_INTEL_82801CA_USB3,
-};
-
diff --git a/src/southbridge/intel/i82801cx/Kconfig b/src/southbridge/intel/i82801cx/Kconfig
new file mode 100644 (file)
index 0000000..a0c775d
--- /dev/null
@@ -0,0 +1,2 @@
+config SOUTHBRIDGE_INTEL_I82801CX
+       bool
diff --git a/src/southbridge/intel/i82801cx/Makefile.inc b/src/southbridge/intel/i82801cx/Makefile.inc
new file mode 100644 (file)
index 0000000..163c072
--- /dev/null
@@ -0,0 +1,8 @@
+driver-y += i82801cx.o
+driver-y += i82801cx_usb.o
+driver-y += i82801cx_lpc.o
+driver-y += i82801cx_ide.o
+driver-y += i82801cx_ac97.o
+#driver-y += i82801cx_nic.o
+driver-y += i82801cx_pci.o
+obj-y += i82801cx_reset.o
diff --git a/src/southbridge/intel/i82801cx/chip.h b/src/southbridge/intel/i82801cx/chip.h
new file mode 100644 (file)
index 0000000..99b069e
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef I82801CX_CHIP_H
+#define I82801CX_CHIP_H
+
+struct southbridge_intel_i82801cx_config 
+{
+};
+extern struct chip_operations southbridge_intel_i82801cx_ops;
+
+#endif /* I82801CX_CHIP_H */
diff --git a/src/southbridge/intel/i82801cx/cmos_failover.c b/src/southbridge/intel/i82801cx/cmos_failover.c
new file mode 100644 (file)
index 0000000..ab1816f
--- /dev/null
@@ -0,0 +1,19 @@
+//kind of cmos_err for ich3
+
+#include "i82801cx.h"
+
+static void check_cmos_failed(void) 
+{
+#if CONFIG_HAVE_OPTION_TABLE
+       uint8_t byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
+
+       if( byte & RTC_BATTERY_DEAD) {
+               // Set boot_option and last_boot to 'Fallback',
+               // clear reboot_bits
+        byte = cmos_read(RTC_BOOT_BYTE);
+        byte &= 0x0c;
+        byte |= CONFIG_MAX_REBOOT_CNT << 4;
+        cmos_write(byte, RTC_BOOT_BYTE);
+    }
+#endif
+}
diff --git a/src/southbridge/intel/i82801cx/i82801cx.c b/src/southbridge/intel/i82801cx/i82801cx.c
new file mode 100644 (file)
index 0000000..ddbbc7d
--- /dev/null
@@ -0,0 +1,53 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <assert.h>
+#include "i82801cx.h"
+
+void i82801cx_enable(device_t dev)
+{
+       unsigned int index = 0;
+       uint8_t bHasDisableBit = 0;
+       uint16_t cur_disable_mask, new_disable_mask;
+
+//     all 82801ca devices are in bus 0
+       unsigned int devfn = PCI_DEVFN(0x1f, 0); // lpc
+       device_t lpc_dev = dev_find_slot(0, devfn); // 0
+       if (!lpc_dev)
+               return;
+
+       // Calculate disable bit position for specified device:function
+       // NOTE: For ICH-3, only the following devices can be disabled:
+       //               D31:F1, D31:F3, D31:F5, D31:F6, 
+       //               D29:F0, D29:F1, D29:F2
+
+    if (PCI_SLOT(dev->path.pci.devfn) == 31) {
+       index = PCI_FUNC(dev->path.pci.devfn);
+
+               if ((index == 1) || (index == 3) || (index == 5) || (index == 6))
+                       bHasDisableBit = 1;
+
+    } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
+       index = 8 + PCI_FUNC(dev->path.pci.devfn);
+
+               if (PCI_FUNC(dev->path.pci.devfn) < 3)
+                       bHasDisableBit = 1;
+    }
+
+       if (bHasDisableBit) {
+               cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
+               new_disable_mask = cur_disable_mask & ~(1<<index);              // enable it
+               if (!dev->enabled) {
+                       new_disable_mask |= (1<<index);  // disable it
+               }
+               if (new_disable_mask != cur_disable_mask) {
+                       pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
+               }
+       }
+}
+
+struct chip_operations southbridge_intel_i82801cx_ops = {
+       CHIP_NAME("Intel ICH3 (82801Cx) Series Southbridge")
+       .enable_dev = i82801cx_enable,
+};
diff --git a/src/southbridge/intel/i82801cx/i82801cx.h b/src/southbridge/intel/i82801cx/i82801cx.h
new file mode 100644 (file)
index 0000000..b9b3511
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef I82801CX_H
+#define I82801CX_H
+
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
+#include "chip.h"
+extern void i82801cx_enable(device_t dev);
+#endif
+
+
+#define PCI_DMA_CFG     0x90
+#define SERIRQ_CNTL     0x64
+#define GEN_CNTL        0xd0
+#define GEN_STS         0xd4
+#define RTC_CONF        0xd8
+#define GEN_PMCON_3     0xa4
+
+#define PMBASE          0x40
+#define ACPI_CNTL       0x44
+#define BIOS_CNTL       0x4E
+#define GPIO_BASE       0x58
+#define GPIO_CNTL       0x5C
+#define PIRQA_ROUT      0x60
+#define PIRQE_ROUT      0x68
+#define COM_DEC         0xE0
+#define LPC_EN          0xE6
+#define FUNC_DIS        0xF2
+
+// GEN_PMCON_3 bits
+#define RTC_BATTERY_DEAD               (1<<2)
+#define RTC_POWER_FAILED               (1<<1)
+#define SLEEP_AFTER_POWER_FAIL (1<<0)
+
+/********************************************************************/
+/*                                                     IDE Controller                          */
+/********************************************************************/
+
+// PCI Configuration Space (D31:F1)
+#define IDE_TIM_PRI            0x40            // IDE timings, primary
+#define IDE_TIM_SEC            0x42            // IDE timings, secondary
+
+
+// IDE_TIM bits
+#define IDE_DECODE_ENABLE      (1<<15)
+
+/********************************************************************/
+/*                                                             SMBus                               */
+/********************************************************************/
+
+// PCI Configuration Space (D31:F3)
+#define SMB_BASE       0x20
+#define HOSTC          0x40
+
+// HOSTC bits
+#define I2C_EN         (1<<2)
+#define SMB_SMI_EN     (1<<1)
+#define HST_EN         (1<<0)
+
+#define SMBUS_IO_BASE 0x1000
+
+// I/O registers (relative to SMBUS_IO_BASE)
+#define SMBHSTSTAT             0
+#define SMBHSTCTL              2
+#define SMBHSTCMD              3
+#define SMBXMITADD             4
+#define SMBHSTDAT0             5
+#define SMBHSTDAT1             6
+#define SMBBLKDAT              7
+#define SMBTRNSADD             9
+#define SMBSLVDATA             10
+#define SMLINK_PIN_CTL 14
+#define SMBUS_PIN_CTL  15 
+
+/* Between 1-10 seconds, We should never timeout normally 
+ * Longer than this is just painful when a timeout condition occurs.
+ */
+#define SMBUS_TIMEOUT (100*1000)
+
+#endif /* I82801CX_H */
diff --git a/src/southbridge/intel/i82801cx/i82801cx_ac97.c b/src/southbridge/intel/i82801cx/i82801cx_ac97.c
new file mode 100644 (file)
index 0000000..5de44fc
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * (C) 2003 Linux Networx
+ */
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801cx.h"
+
+
+static struct device_operations ac97audio_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .enable           = i82801cx_enable,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver ac97audio_driver __pci_driver = {
+       .ops    = &ac97audio_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_AUDIO,
+};
+
+
+static struct device_operations ac97modem_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .enable           = i82801cx_enable,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver ac97modem_driver __pci_driver = {
+       .ops    = &ac97modem_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_MODEM,
+};
diff --git a/src/southbridge/intel/i82801cx/i82801cx_early_smbus.c b/src/southbridge/intel/i82801cx/i82801cx_early_smbus.c
new file mode 100644 (file)
index 0000000..9c34802
--- /dev/null
@@ -0,0 +1,134 @@
+#include <device/pci_ids.h>
+#include "i82801cx.h"
+
+static void enable_smbus(void)
+{
+       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
+
+       print_debug("SMBus controller enabled\r\n");
+       /* set smbus iobase */
+       pci_write_config32(dev, SMB_BASE, SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+       /* Set smbus enable */
+       pci_write_config8(dev, HOSTC, HST_EN);
+       /* Set smbus iospace enable */ 
+       pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
+       /* Disable interrupt generation */ 
+       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+}
+
+
+static inline void smbus_delay(void)
+{
+       outb(0x80, 0x80);
+}
+
+// See http://www.coreboot.org/pipermail/linuxbios/2004-September/009077.html
+// for a description of this function.
+static int smbus_wait_until_active(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               if ((val & 1)) {
+                       break;
+               }
+       } while (--loops);
+       return loops ? 0 : -4;
+}
+
+static int smbus_wait_until_ready(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               // !HOST_BUSY?
+               if ((val & 1) == 0) {
+                       break;
+               }
+               if(loops == (SMBUS_TIMEOUT / 2)) {
+                       // Clear status flags
+                       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
+                               SMBUS_IO_BASE + SMBHSTSTAT);
+               }
+       } while(--loops);
+       return loops?0:-2;
+}
+
+static int smbus_wait_until_done(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               // !HOST_BUSY?
+               if ( (val & 1) == 0) {
+                       break;
+               }
+               // BYTE_DONE or SUCCESS or error?
+               if ((val & ~((1<<6)|(1<<0)) ) != 0 ) {
+                       break;
+               }
+       } while(--loops);
+       return loops?0:-3;
+}
+
+static int smbus_read_byte(unsigned device, unsigned address)
+{
+       unsigned char global_control_register;
+       unsigned char global_status_register;
+       unsigned char byte;
+
+       if (smbus_wait_until_ready() < 0) {
+               return -2;
+       }
+       
+       /* setup transaction */
+       /* disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xfe, SMBUS_IO_BASE + SMBHSTCTL);
+       /* set to read from the specified device  */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
+       /* set the command/address... */
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       /* set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2<<2), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* clear the data byte...*/
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* start a byte read, with interrupts disabled */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
+       /* poll for it to start */
+       if (smbus_wait_until_active() < 0) {
+               return -4;
+       }
+
+       /* poll for transaction completion */
+       if (smbus_wait_until_done() < 0) {
+               return -3;
+       }
+
+       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT) & ~(1<<6); /* Ignore the In Use Status... */
+
+       /* read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+
+       // SUCCESS?
+       if (global_status_register != 2) {
+               return -1;
+       }
+       return byte;
+}
diff --git a/src/southbridge/intel/i82801cx/i82801cx_ide.c b/src/southbridge/intel/i82801cx/i82801cx_ide.c
new file mode 100644 (file)
index 0000000..2506b2f
--- /dev/null
@@ -0,0 +1,48 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801cx.h"
+
+
+static void ide_init(struct device *dev)
+{
+       /* Enable ide devices so the linux ide driver will work */
+       uint16_t ideTimingConfig;
+       int enable_primary = 1;
+       int enable_secondary = 1;
+
+       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
+       ideTimingConfig &= ~IDE_DECODE_ENABLE;
+       if (enable_primary) {
+               /* Enable first ide interface */
+               ideTimingConfig |= IDE_DECODE_ENABLE;
+               printk_debug("IDE0 ");
+       }
+       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
+
+    ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
+    ideTimingConfig &= ~IDE_DECODE_ENABLE;
+    if (enable_secondary) {
+               /* Enable secondary ide interface */
+        ideTimingConfig |= IDE_DECODE_ENABLE;
+        printk_debug("IDE1 ");
+       }
+    pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
+}
+
+static struct device_operations ide_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = ide_init,
+       .scan_bus         = 0,
+       .enable           = i82801cx_enable,
+};
+
+static const struct pci_driver ide_driver __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_IDE,
+};
diff --git a/src/southbridge/intel/i82801cx/i82801cx_lpc.c b/src/southbridge/intel/i82801cx/i82801cx_lpc.c
new file mode 100644 (file)
index 0000000..4785242
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * (C) 2003 Linux Networx, SuSE Linux AG
+ * (C) 2004 Tyan Computer
+ * (c) 2005 Digital Design Corporation
+ */
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include <pc80/mc146818rtc.h>
+#include <pc80/isa-dma.h>
+#include <arch/io.h>
+#include "i82801cx.h"
+
+#define NMI_OFF 0
+
+#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
+#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
+#endif
+
+#define MAINBOARD_POWER_OFF 0
+#define MAINBOARD_POWER_ON  1
+
+
+void i82801cx_enable_ioapic( struct device *dev) 
+{
+       uint32_t dword;
+    volatile uint32_t* ioapic_index = (volatile uint32_t*)0xfec00000;
+    volatile uint32_t* ioapic_data = (volatile uint32_t*)0xfec00010;
+
+    dword = pci_read_config32(dev, GEN_CNTL);
+    dword |= (3 << 7); /* enable ioapic & disable SMBus interrupts */
+    dword |= (1 <<13); /* coprocessor error enable */
+    dword |= (1 << 1); /* delay transaction enable */
+    dword |= (1 << 2); /* DMA collection buf enable */
+    pci_write_config32(dev, GEN_CNTL, dword);
+    printk_debug("ioapic southbridge enabled %x\n",dword);
+        
+    // Must program the APIC's ID before using it
+
+    *ioapic_index = 0;         // Select APIC ID register
+    *ioapic_data = (2<<24);
+        
+    // Hang if the ID didn't take (chip not present?)
+    *ioapic_index = 0;
+    dword = *ioapic_data;
+    printk_debug("Southbridge apic id = %x\n", (dword>>24) & 0xF);
+    if(dword != (2<<24))
+               die("");
+
+       *ioapic_index = 3;              // Select Boot Configuration register
+       *ioapic_data = 1;               // Use Processor System Bus to deliver interrupts
+}
+
+// This is how interrupts are received from the Super I/O chip
+void i82801cx_enable_serial_irqs( struct device *dev)
+{
+       // Recognize serial IRQs, continuous mode, frame size 21, 4 clock start frame pulse width
+    pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0<< 0));
+}
+
+//----------------------------------------------------------------------------------
+// Function:           i82801cx_lpc_route_dma
+// Parameters:         dev
+//                                     mask - identifies whether each channel should be used for PCI DMA
+//                                                (bit = 0) or LPC DMA (bit = 1). The LSb controls channel 0.
+//                                                Channel 4 is not used (reserved). 
+// Return Value:       None
+// Description:        Route all DMA channels to either PCI or LPC.
+//
+void i82801cx_lpc_route_dma( struct device *dev, uint8_t mask) 
+{
+    uint16_t dmaConfig;
+    int channelIndex;
+
+    dmaConfig = pci_read_config16(dev, PCI_DMA_CFG);
+    dmaConfig &= 0x300;                                // Preserve reserved bits
+    for(channelIndex = 0; channelIndex < 8; channelIndex++) {
+       if (channelIndex == 4)
+               continue;               // Register doesn't support channel 4
+        dmaConfig |= ((mask & (1 << channelIndex))? 3:1) << (channelIndex*2);
+    }
+    pci_write_config16(dev, PCI_DMA_CFG, dmaConfig);
+}
+
+void i82801cx_rtc_init(struct device *dev)
+{
+    uint32_t dword;
+    int rtc_failed;
+       int pwr_on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
+    uint8_t pmcon3 = pci_read_config8(dev, GEN_PMCON_3);
+
+    rtc_failed = pmcon3 & RTC_BATTERY_DEAD;
+    if (rtc_failed) {
+       // Clear the RTC_BATTERY_DEAD bit, but preserve
+        // the RTC_POWER_FAILED, G3 state, and reserved bits
+               // NOTE: RTC_BATTERY_DEAD and RTC_POWER_FAILED are "write-1-clear" bits
+        pmcon3 &= ~RTC_POWER_FAILED;
+    }
+
+    get_option(&pwr_on, "power_on_after_fail");
+       pmcon3 &= ~SLEEP_AFTER_POWER_FAIL;
+       if (!pwr_on) {
+               pmcon3 |= SLEEP_AFTER_POWER_FAIL;
+       }
+       pci_write_config8(dev, GEN_PMCON_3, pmcon3);
+       printk_info("set power %s after power fail\n", 
+                                pwr_on ? "on" : "off");
+
+    // See if the Safe Mode jumper is set
+    dword = pci_read_config32(dev, GEN_STS);
+    rtc_failed |= dword & (1 << 2);
+        
+    rtc_init(rtc_failed);
+}
+
+
+void i82801cx_1f0_misc(struct device *dev)
+{
+       // Prevent LPC disabling, enable parity errors, and SERR# (System Error)
+    pci_write_config16(dev, PCI_COMMAND, 0x014f);
+        
+    // Set ACPI base address to 0x1100 (I/O space)
+    pci_write_config32(dev, PMBASE, 0x00001101);
+        
+    // Enable ACPI I/O and power management
+    pci_write_config8(dev, ACPI_CNTL, 0x10);
+        
+    // Set GPIO base address to 0x1180 (I/O space)
+    pci_write_config32(dev, GPIO_BASE, 0x00001181);
+        
+    // Enable GPIO
+    pci_write_config8(dev, GPIO_CNTL, 0x10);
+        
+    // Route PIRQA to IRQ11, PIRQB to IRQ3, PIRQC to IRQ5, PIRQD to IRQ10
+    pci_write_config32(dev, PIRQA_ROUT, 0x0A05030B);
+        
+    // Route PIRQE to IRQ7. Leave PIRQF - PIRQH unrouted.
+    pci_write_config8(dev, PIRQE_ROUT, 0x07);
+        
+    // Enable access to the upper 128 byte bank of CMOS RAM
+    pci_write_config8(dev, RTC_CONF, 0x04);
+        
+    // Decode 0x3F8-0x3FF (COM1) for COMA port,
+       //                0x2F8-0x2FF (COM2) for COMB
+    pci_write_config8(dev, COM_DEC, 0x10);
+
+       // LPT decode defaults to 0x378-0x37F and 0x778-0x77F
+       // Floppy decode defaults to 0x3F0-0x3F5, 0x3F7
+
+    // Enable COMA, COMB, LPT, floppy; 
+       // disable microcontroller, Super I/O, sound, gameport
+    pci_write_config16(dev, LPC_EN, 0x000F);
+}
+
+static void lpc_init(struct device *dev)
+{
+       uint8_t byte;
+       int pwr_on=-1;
+       int nmi_option;
+
+       /* IO APIC initialization */
+       i82801cx_enable_ioapic(dev);
+
+       i82801cx_enable_serial_irqs(dev);
+       
+       /* power after power fail */
+               /* FIXME this doesn't work! */
+        /* Which state do we want to goto after g3 (power restored)?
+         * 0 == S0 Full On
+         * 1 == S5 Soft Off
+         */
+    byte = pci_read_config8(dev, GEN_PMCON_3);
+    if (pwr_on)
+       byte &= ~1;             // Return to S0 (boot) after power is re-applied
+    else
+       byte |= 1;              // Return to S5
+    pci_write_config8(dev, GEN_PMCON_3, byte);
+    printk_info("set power %s after power fail\n", pwr_on?"on":"off");
+
+    /* Set up NMI on errors */
+    byte = inb(0x61);
+    byte &= ~(1 << 3); /* IOCHK# NMI Enable */
+    byte &= ~(1 << 2); /* PCI SERR# Enable */
+    outb(byte, 0x61);
+    byte = inb(0x70);
+    nmi_option = NMI_OFF;
+    get_option(&nmi_option, "nmi");
+    if (nmi_option) {                  
+        byte &= ~(1 << 7); /* set NMI */
+        outb(byte, 0x70);
+    }
+       
+       /* Initialize the real time clock */
+       i82801cx_rtc_init(dev);
+
+       i82801cx_lpc_route_dma(dev, 0xff);
+
+       /* Initialize isa dma */
+       isa_dma_init();
+
+       i82801cx_1f0_misc(dev);
+}
+
+static void i82801cx_lpc_read_resources(device_t dev)
+{
+       struct resource *res;
+
+       /* Get the normal PCI resources of this device. */
+       pci_dev_read_resources(dev);
+
+       /* Add an extra subtractive resource for both memory and I/O. */
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void i82801cx_lpc_enable_resources(device_t dev)
+{
+       pci_dev_enable_resources(dev);
+       enable_childrens_resources(dev);
+}
+
+static struct device_operations lpc_ops  = {
+       .read_resources   = i82801cx_lpc_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = i82801cx_lpc_enable_resources,
+       .init             = lpc_init,
+       .scan_bus         = scan_static_bus,
+       .enable           = 0,
+};
+
+static const struct pci_driver lpc_driver __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_LPC,
+};
diff --git a/src/southbridge/intel/i82801cx/i82801cx_nic.c b/src/southbridge/intel/i82801cx/i82801cx_nic.c
new file mode 100644 (file)
index 0000000..00ce038
--- /dev/null
@@ -0,0 +1,21 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801cx.h"
+
+
+static struct device_operations nic_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver nic_driver __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_LAN,
+};
diff --git a/src/southbridge/intel/i82801cx/i82801cx_pci.c b/src/southbridge/intel/i82801cx/i82801cx_pci.c
new file mode 100644 (file)
index 0000000..842b214
--- /dev/null
@@ -0,0 +1,30 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801cx.h"
+
+static void pci_init(struct device *dev)
+{
+       // NOTE: the original (v1) 'CA code set these in the bridge register (0x3E-3F)
+       /* Enable pci error detecting */
+       uint32_t dword = pci_read_config32(dev, PCI_COMMAND);
+       dword |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
+       pci_write_config32(dev, PCI_COMMAND, dword);
+}
+
+static struct device_operations pci_ops  = {
+       .read_resources   = pci_bus_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_bus_enable_resources,
+       .init             = pci_init,
+       .scan_bus         = pci_scan_bridge,
+};
+
+static const struct pci_driver pci_driver __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_PCI,
+};
+
diff --git a/src/southbridge/intel/i82801cx/i82801cx_reset.c b/src/southbridge/intel/i82801cx/i82801cx_reset.c
new file mode 100644 (file)
index 0000000..20e8530
--- /dev/null
@@ -0,0 +1,8 @@
+#include <arch/io.h>
+
+void i82801cx_hard_reset(void)
+{
+        /* Try rebooting through port 0xcf9 */
+        // Hard reset without power cycle
+        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
+}
diff --git a/src/southbridge/intel/i82801cx/i82801cx_smbus.c b/src/southbridge/intel/i82801cx/i82801cx_smbus.c
new file mode 100644 (file)
index 0000000..b69bbc1
--- /dev/null
@@ -0,0 +1,83 @@
+#include <smbus.h>
+#include <pci.h>
+#include <arch/io.h>
+#include "i82801cx.h"
+
+#define PM_BUS 0
+#define PM_DEVFN PCI_DEVFN(0x1f,3)
+
+void smbus_enable(void)
+{
+       /* iobase addr */
+       pcibios_write_config_dword(PM_BUS, PM_DEVFN, SMB_BASE, 
+                                                          SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+       /* smbus enable */
+       pcibios_write_config_byte(PM_BUS, PM_DEVFN, HOSTC, HST_EN);
+       /* iospace enable */
+       pcibios_write_config_word(PM_BUS, PM_DEVFN, PCI_COMMAND, PCI_COMMAND_IO);
+
+    /* Disable interrupt generation */
+    outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+}
+
+static void smbus_wait_until_ready(void)
+{
+       // Loop while HOST_BUSY
+       while((inb(SMBUS_IO_BASE + SMBHSTSTAT) & 1) == 1) {
+               /* nop */
+       }
+}
+
+static void smbus_wait_until_done(void)
+{
+       unsigned char byte;
+       
+       // Loop while HOST_BUSY
+       do {
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+       while((byte &1) == 1);
+       
+       // Wait for SUCCESS or error or BYTE_DONE
+       while( (byte & ~1) == 0) {
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+}
+
+int smbus_read_byte(unsigned device, unsigned address, unsigned char *result)
+{
+       unsigned char host_status_register;
+       unsigned char byte;
+
+       smbus_wait_until_ready();
+
+       /* setup transaction */
+       /* disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+       /* set to read from the specified device  */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADD);
+       /* set the command/address... */
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       /* set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x2 << 2), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* clear the data byte...*/
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* start the command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* poll for transaction completion */
+       smbus_wait_until_done();
+
+       host_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+
+       *result = byte;
+       return host_status_register != 0x02;            // return true if !SUCCESS
+}
diff --git a/src/southbridge/intel/i82801cx/i82801cx_usb.c b/src/southbridge/intel/i82801cx/i82801cx_usb.c
new file mode 100644 (file)
index 0000000..258581a
--- /dev/null
@@ -0,0 +1,49 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801cx.h"
+
+static void usb_init(struct device *dev)
+{
+
+#if 0
+       uint32_t cmd;
+       printk_debug("USB: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, 
+               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
+               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
+
+
+       printk_debug("done.\n");
+#endif
+
+}
+
+static struct device_operations usb_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = usb_init,
+       .scan_bus         = 0,
+       .enable           = i82801cx_enable,
+};
+
+static const struct pci_driver usb_driver_1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801CA_USB1,
+};
+static const struct pci_driver usb_driver_2 __pci_driver = {
+        .ops    = &usb_ops,
+        .vendor = PCI_VENDOR_ID_INTEL,
+        .device = PCI_DEVICE_ID_INTEL_82801CA_USB2,
+};
+static const struct pci_driver usb_driver_3 __pci_driver = {
+        .ops    = &usb_ops,
+        .vendor = PCI_VENDOR_ID_INTEL,
+        .device = PCI_DEVICE_ID_INTEL_82801CA_USB3,
+};
+
diff --git a/src/southbridge/intel/i82801dbm/Kconfig b/src/southbridge/intel/i82801dbm/Kconfig
deleted file mode 100644 (file)
index 3433d59..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-config SOUTHBRIDGE_INTEL_I82801DBM
-       bool
diff --git a/src/southbridge/intel/i82801dbm/Makefile.inc b/src/southbridge/intel/i82801dbm/Makefile.inc
deleted file mode 100644 (file)
index 7134279..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-driver-y += i82801dbm.o
-driver-y += i82801dbm_usb.o
-driver-y += i82801dbm_lpc.o
-driver-y += i82801dbm_ide.o
-driver-y += i82801dbm_usb2.o
-driver-y += i82801dbm_ac97.o
-#driver-y += i82801dbm_nic.o
-#driver-y += i82801dbm_pci.o
-obj-y += i82801dbm_reset.o
diff --git a/src/southbridge/intel/i82801dbm/chip.h b/src/southbridge/intel/i82801dbm/chip.h
deleted file mode 100644 (file)
index e1e3da0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef I82801DBM_CHIP_H
-#define I82801DBM_CHIP_H
-
-struct southbridge_intel_i82801dbm_config 
-{
-       int enable_usb;
-       int enable_native_ide;
-};
-struct chip_operations;
-extern struct chip_operations southbridge_intel_i82801dbm_ops;
-
-#endif /* I82801DBM_CHIP_H */
diff --git a/src/southbridge/intel/i82801dbm/cmos_failover.c b/src/southbridge/intel/i82801dbm/cmos_failover.c
deleted file mode 100644 (file)
index 4821fad..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-//kind of cmos_err for ich5
-#define RTC_FAILED    (1 <<2)
-#define GEN_PMCON_3     0xa4
-static void check_cmos_failed(void) 
-{
-
-                uint8_t byte;
-                byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
-                if( byte & RTC_FAILED){
-//clear bit 1 and bit 2
-                        byte = cmos_read(RTC_BOOT_BYTE);
-                        byte &= 0x0c;
-                        byte |= CONFIG_MAX_REBOOT_CNT << 4;
-                        cmos_write(byte, RTC_BOOT_BYTE);
-                }
-}
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm.c b/src/southbridge/intel/i82801dbm/i82801dbm.c
deleted file mode 100644 (file)
index 157ffca..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801dbm.h"
-
-void i82801dbm_enable(device_t dev)
-{
-       unsigned int index = 0;
-       uint8_t bHasDisableBit = 0;
-       uint16_t cur_disable_mask, new_disable_mask;
-
-//     all 82801dbm devices are in bus 0
-       unsigned int devfn = PCI_DEVFN(0x1f, 0); // lpc
-       device_t lpc_dev = dev_find_slot(0, devfn); // 0
-       if (!lpc_dev)
-               return;
-
-       // Calculate disable bit position for specified device:function
-       // NOTE: For ICH-4, only the following devices can be disabled:
-       //               D31: F0, F1, F3, F5, F6, 
-       //               D29: F0, F1, F2, F7
-
-    if (PCI_SLOT(dev->path.pci.devfn) == 31) {
-       index = PCI_FUNC(dev->path.pci.devfn);
-
-               switch (index) {
-                       case 0:
-                       case 1:
-                       case 3:
-                       case 5:
-                       case 6:
-                               bHasDisableBit = 1;
-                               break;
-                       
-                       default:
-                               break;
-               };
-               
-               if (index == 0)
-                       index = 14;             // D31:F0 bit is an exception
-
-    } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
-       index = 8 + PCI_FUNC(dev->path.pci.devfn);
-
-               if ((PCI_FUNC(dev->path.pci.devfn) < 3) || (PCI_FUNC(dev->path.pci.devfn) == 7))
-                       bHasDisableBit = 1;
-    }
-
-       if (bHasDisableBit) {
-               cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
-               new_disable_mask = cur_disable_mask & ~(1<<index);              // enable it
-               if (!dev->enabled) {
-                       new_disable_mask |= (1<<index);  // disable it
-               }
-               if (new_disable_mask != cur_disable_mask) {
-                       pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
-               }
-       }
-}
-
-struct chip_operations southbridge_intel_i82801dbm_ops = {
-       CHIP_NAME("Intel 82801DBM Southbridge")
-       .enable_dev = i82801dbm_enable,
-};
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm.h b/src/southbridge/intel/i82801dbm/i82801dbm.h
deleted file mode 100644 (file)
index 824d23a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/* the problem: we have 82801dbm support in fb1, and 82801er in fb2. 
- * fb1 code is what we want, fb2 structure is needed however. 
- * so we need to get fb1 code for 82801dbm into fb2 structure. 
- */
-/* What I did: took the 80801er stuff from fb2, verify it against the 
- * db stuff in fb1, and made sure it was right.
- */
-
-#ifndef I82801DBM_H
-#define I82801DBM_H
-
-#include "chip.h"
-extern void i82801dbm_enable(device_t dev);
-
-/*
-000 = Non-combined. P0 is primary master. P1 is secondary master.
-001 = Non-combined. P0 is secondary master. P1 is primary master.
-100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary; Primary IDE channel
-disabled.
-101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary.
-110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary slave; Secondary IDE
-channel disabled.
-111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master.
-*/
-
-#define PCI_DMA_CFG     0x90
-#define SERIRQ_CNTL     0x64
-#define GEN_CNTL        0xd0
-#define GEN_STS         0xd4
-#define RTC_CONF        0xd8
-#define GEN_PMCON_3     0xa4
-
-#define PCICMD          0x04
-#define PMBASE          0x40
-#define ACPI_CNTL       0x44
-#define BIOS_CNTL       0x4E
-#define GPIO_BASE       0x58
-#define GPIO_CNTL       0x5C
-#define PIRQA_ROUT      0x60
-#define PIRQE_ROUT      0x68
-#define COM_DEC         0xE0
-#define LPC_EN          0xE6
-#define FUNC_DIS        0xF2
-
-/* 1e f0 244e */
-
-#define CMD             0x04
-#define SBUS_NUM        0x19
-#define SUB_BUS_NUM     0x1A
-#define SMLT            0x1B
-#define IOBASE          0x1C
-#define IOLIM           0x1D
-#define MEMBASE         0x20
-#define MEMLIM          0x22
-#define CNF             0x50
-#define MTT             0x70
-#define PCI_MAST_STS    0x82
-
-#define RTC_FAILED      (1 <<2)
-
-
-#define SMBUS_IO_BASE 0x1000
-
-#define SMBHSTSTAT 0x0
-#define SMBHSTCTL  0x2
-#define SMBHSTCMD  0x3
-#define SMBXMITADD 0x4
-#define SMBHSTDAT0 0x5
-#define SMBHSTDAT1 0x6
-#define SMBBLKDAT  0x7
-#define SMBTRNSADD 0x9
-#define SMBSLVDATA 0xa
-#define SMLINK_PIN_CTL 0xe
-#define SMBUS_PIN_CTL  0xf 
-
-/* Between 1-10 seconds, We should never timeout normally 
- * Longer than this is just painful when a timeout condition occurs.
- */
-#define SMBUS_TIMEOUT (100*1000)
-
-#endif /* I82801DBM_H */
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_ac97.c b/src/southbridge/intel/i82801dbm/i82801dbm_ac97.c
deleted file mode 100644 (file)
index 3b36401..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * (C) 2003 Linux Networx
- */
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-
-static struct device_operations ac97audio_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable           = i82801dbm_enable,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver ac97audio_driver __pci_driver = {
-       .ops    = &ac97audio_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_AC97_AUDIO,
-};
-
-
-static struct device_operations ac97modem_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable           = i82801dbm_enable,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver ac97modem_driver __pci_driver = {
-       .ops    = &ac97modem_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_AC97_MODEM,
-};
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_early_smbus.c b/src/southbridge/intel/i82801dbm/i82801dbm_early_smbus.c
deleted file mode 100644 (file)
index a85c08b..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-
-//#define SMBUS_IO_BASE 0x1000
-#define SMBUS_IO_BASE 0x0f00
-
-#define SMBHSTSTAT 0x0
-#define SMBHSTCTL  0x2
-#define SMBHSTCMD  0x3
-#define SMBXMITADD 0x4
-#define SMBHSTDAT0 0x5
-#define SMBHSTDAT1 0x6
-#define SMBBLKDAT  0x7
-#define SMBTRNSADD 0x9
-#define SMBSLVDATA 0xa
-#define SMLINK_PIN_CTL 0xe
-#define SMBUS_PIN_CTL  0xf 
-
-/* Between 1-10 seconds, We should never timeout normally 
- * Longer than this is just painful when a timeout condition occurs.
- */
-#define SMBUS_TIMEOUT (100*1000*10)
-
-static void enable_smbus(void)
-{
-       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
-
-       print_debug("SMBus controller enabled\r\n");
-       /* set smbus iobase */
-       pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
-       /* Set smbus enable */
-       pci_write_config8(dev, 0x40, 0x01);
-       /* Set smbus iospace enable */ 
-       pci_write_config16(dev, 0x4, 0x01);
-       /* Disable interrupt generation */ 
-       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-}
-
-
-static inline void smbus_delay(void)
-{
-       outb(0x80, 0x80);
-}
-
-static int smbus_wait_until_active(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               if ((val & 1)) {
-                       break;
-               }
-       } while(--loops);
-       return loops?0:-4;
-}
-
-static int smbus_wait_until_ready(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               if ((val & 1) == 0) {
-                       break;
-               }
-               if(loops == (SMBUS_TIMEOUT / 2)) {
-                       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
-                               SMBUS_IO_BASE + SMBHSTSTAT);
-               }
-       } while(--loops);
-       return loops?0:-2;
-}
-
-static int smbus_wait_until_done(void)
-{
-       unsigned long loops;
-       loops = SMBUS_TIMEOUT;
-       do {
-               unsigned char val;
-               smbus_delay();
-               
-               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-               if ( (val & 1) == 0) {
-                       break;
-               }
-               if ((val & ~((1<<6)|(1<<0)) ) != 0 ) {
-                       break;
-               }
-       } while(--loops);
-       return loops?0:-3;
-}
-
-static int smbus_read_byte(unsigned device, unsigned address)
-{
-       unsigned char global_control_register;
-       unsigned char global_status_register;
-       unsigned char byte;
-
-       /*print_err("smbus_read_byte\r\n");*/
-       if (smbus_wait_until_ready() < 0) {
-               print_err_hex8(-2);
-               return -2;
-       }
-       
-       /* setup transaction */
-       /* disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xfe, SMBUS_IO_BASE + SMBHSTCTL);
-       /* set the device I'm talking too */
-       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
-       /* set the command/address... */
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       /* set up for a byte data read */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2<<2), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* clear the data byte...*/
-       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* start a byte read, with interrupts disabled */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
-       /* poll for it to start */
-       if (smbus_wait_until_active() < 0) {
-               print_err_hex8(-4);
-               return -4;
-       }
-
-       /* poll for transaction completion */
-       if (smbus_wait_until_done() < 0) {
-               print_err_hex8(-3);
-               return -3;
-       }
-
-       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT) & ~(1<<6); /* Ignore the In Use Status... */
-
-       /* read results of transaction */
-       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
-
-       if (global_status_register != 2) {
-               print_err_hex8(-1);
-               return -1;
-       }
-/*
-        print_err("smbus_read_byte: ");
-       print_err_hex32(device); print_err(" ad "); print_err_hex32(address);
-       print_err("value "); print_err_hex8(byte); print_err("\r\n");
- */
-       return byte;
-}
-#if 0
-static void smbus_write_byte(unsigned device, unsigned address, unsigned char val)
-{
-       if (smbus_wait_until_ready() < 0) {
-               return;
-       }
-
-       /* by LYH */
-       outb(0x37,SMBUS_IO_BASE + SMBHSTSTAT);
-       /* set the device I'm talking too */
-       outw(((device & 0x7f) << 1) | 0, SMBUS_IO_BASE + SMBHSTADDR);
-
-       /* data to send */
-       outb(val, SMBUS_IO_BASE + SMBHSTDAT);
-
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-
-       /* start the command */
-       outb(0xa, SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* poll for transaction completion */
-       smbus_wait_until_done();
-       return;
-}
-#endif
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_ide.c b/src/southbridge/intel/i82801dbm/i82801dbm_ide.c
deleted file mode 100644 (file)
index f7d7996..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-
-static void ide_init(struct device *dev)
-{
-#if ICH5_SATA_ADDRESS_MAP<=1
-       /* Enable ide devices so the linux ide driver will work */
-       uint16_t word;
-       uint8_t byte;
-       int enable_a=1, enable_b=1;
-
-
-       word = pci_read_config16(dev, 0x40);
-       word &= ~((1 << 15));
-       if (enable_a) {
-               /* Enable first ide interface */
-               word |= (1<<15);
-               printk_debug("IDE0 ");
-       }
-       pci_write_config16(dev, 0x40, word);
-
-        word = pci_read_config16(dev, 0x42);
-        word &= ~((1 << 15));
-        if (enable_b) {
-                /* Enable secondary ide interface */
-                word |= (1<<15);
-                printk_debug("IDE1 ");
-        }
-        pci_write_config16(dev, 0x42, word);
-#endif
-
-}
-
-static struct device_operations ide_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = ide_init,
-       .scan_bus         = 0,
-       .enable           = i82801dbm_enable,
-};
-
-static const struct pci_driver ide_driver __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_IDE,
-};
-
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c b/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
deleted file mode 100644 (file)
index c461673..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * (C) 2003 Linux Networx, SuSE Linux AG
- * (C) 2004 Tyan Computer
- */
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <pc80/mc146818rtc.h>
-#include <pc80/isa-dma.h>
-#include <arch/io.h>
-#include "i82801dbm.h"
-
-
-
-#define NMI_OFF 0
-
-void i82801dbm_enable_ioapic( struct device *dev) 
-{
-        uint32_t dword;
-        volatile uint32_t *ioapic_sba = (volatile uint32_t *)0xfec00000;
-        volatile uint32_t *ioapic_sbd = (volatile uint32_t *)0xfec00010;
-
-        dword = pci_read_config32(dev, GEN_CNTL);
-        dword |= (3 << 7); /* enable ioapic */
-        dword |= (1 <<13); /* coprocessor error enable */
-        dword |= (1 << 1); /* delay transaction enable */
-        dword |= (1 << 2); /* DMA collection buf enable */
-        pci_write_config32(dev, GEN_CNTL, dword);
-        printk_debug("ioapic southbridge enabled %x\n",dword);
-        *ioapic_sba=0;
-        *ioapic_sbd=(2<<24);
-        //lyh *ioapic_sba=3;
-        //lyh *ioapic_sbd=1;    
-        *ioapic_sba=0;
-        dword=*ioapic_sbd;
-        printk_debug("Southbridge apic id = %x\n",dword);
-        if(dword!=(2<<24))
-                die("");
-        //lyh *ioapic_sba=3;
-        //lyh dword=*ioapic_sbd;
-        //lyh printk_debug("Southbridge apic DT = %x\n",dword);
-        //lyh if(dword!=1)
-        //lyh   die("");
-
-
-}
-void i82801dbm_enable_serial_irqs( struct device *dev)
-{
-        pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0<< 0));
-}
-void i82801dbm_lpc_route_dma( struct device *dev, uint8_t mask) 
-{
-        uint16_t word;
-        int i;
-        word = pci_read_config16(dev, PCI_DMA_CFG);
-        word &= ((1 << 10) - (1 << 8));
-        for(i = 0; i < 8; i++) {
-                if (i == 4)
-                        continue;
-                word |= ((mask & (1 << i))? 3:1) << (i*2);
-        }
-        pci_write_config16(dev, PCI_DMA_CFG, word);
-}
-void i82801dbm_rtc_init(struct device *dev)
-{
-        uint8_t byte;
-        uint32_t dword;
-        int rtc_failed;
-        byte = pci_read_config8(dev, GEN_PMCON_3);
-        rtc_failed = byte & RTC_FAILED;
-        if (rtc_failed) {
-                byte &= ~(1 << 1); /* preserve the power fail state */
-                pci_write_config8(dev, GEN_PMCON_3, byte);
-        }
-        dword = pci_read_config32(dev, GEN_STS);
-        rtc_failed |= dword & (1 << 2);
-        rtc_init(rtc_failed);
-}
-
-
-void i82801dbm_1f0_misc(struct device *dev)
-{
-        pci_write_config16(dev, PCICMD, 0x014f);
-        pci_write_config32(dev, PMBASE, 0x00001001);
-        pci_write_config8(dev, ACPI_CNTL, 0x10);
-        pci_write_config32(dev, GPIO_BASE, 0x00001181);
-        pci_write_config8(dev, GPIO_CNTL, 0x10);
-        pci_write_config32(dev, PIRQA_ROUT, 0x0A05030B);
-        pci_write_config8(dev, PIRQE_ROUT, 0x07);
-        pci_write_config8(dev, RTC_CONF, 0x04);
-        pci_write_config8(dev, COM_DEC, 0x10);  //lyh E0->
-        pci_write_config16(dev, LPC_EN, 0x000F);  //LYH 000D->
-}
-
-static void enable_hpet(struct device *dev)
-{
-       const unsigned long hpet_address = 0xfed0000;
-
-        uint32_t dword;
-       uint32_t code = (0 & 0x3);
-        
-        dword = pci_read_config32(dev, GEN_CNTL);
-        dword |= (1 << 17); /* enable hpet */
-       /*Bits [16:15]Memory Address Range
-       00 FED0_0000h - FED0_03FFh
-       01 FED0_1000h - FED0_13FFh
-       10 FED0_2000h - FED0_23FFh
-       11 FED0_3000h - FED0_33FFh*/
-
-        dword &= ~(3 << 15); /* clear it */
-       dword |= (code<<15);
-
-       printk_debug("enabling HPET @0x%x\n", hpet_address | (code <<12) );
-}
-
-static void lpc_init(struct device *dev)
-{
-       uint8_t byte;
-       int pwr_on=-1;
-       int nmi_option;
-
-       /* IO APIC initialization */
-       i82801dbm_enable_ioapic(dev);
-
-       i82801dbm_enable_serial_irqs(dev);
-
-#ifdef SUSPICIOUS_LOOKING_CODE 
-       // The ICH-4 datasheet does not mention this configuration register. 
-       // This code may have been inherited (incorrectly) from code for the AMD 766 southbridge,
-       // which *does* support this functionality.
-
-       /* posted memory write enable */
-       byte = pci_read_config8(dev, 0x46);
-       pci_write_config8(dev, 0x46, byte | (1<<0)); 
-#endif
-
-       /* power after power fail */
-               /* FIXME this doesn't work! */
-        /* Which state do we want to goto after g3 (power restored)?
-         * 0 == S0 Full On
-         * 1 == S5 Soft Off
-         */
-        pci_write_config8(dev, GEN_PMCON_3, pwr_on?0:1);
-        printk_info("set power %s after power fail\n", pwr_on?"on":"off");
-#if 0
-       /* Enable Error reporting */
-       /* Set up sync flood detected */
-       byte = pci_read_config8(dev, 0x47);
-       byte |= (1 << 1);
-       pci_write_config8(dev, 0x47, byte);
-#endif
-
-       /* Set up NMI on errors */
-    byte = inb(0x61);
-    byte &= ~(1 << 3); /* IOCHK# NMI Enable */
-    byte &= ~(1 << 2); /* PCI SERR# Enable */
-    outb(byte, 0x61);
-    byte = inb(0x70);
-       nmi_option = NMI_OFF;
-       get_option(&nmi_option, "nmi");
-       if (nmi_option) {                       
-        byte &= ~(1 << 7); /* set NMI */
-        outb(byte, 0x70);
-       }
-       
-       /* Initialize the real time clock */
-       i82801dbm_rtc_init(dev);
-
-       i82801dbm_lpc_route_dma(dev, 0xff);
-
-       /* Initialize isa dma */
-       isa_dma_init();
-
-       i82801dbm_1f0_misc(dev);
-       /* Initialize the High Precision Event Timers */
-       enable_hpet(dev);
-}
-
-static void i82801dbm_lpc_read_resources(device_t dev)
-{
-       struct resource *res;
-
-       /* Get the normal PCI resources of this device. */
-       pci_dev_read_resources(dev);
-
-       /* Add an extra subtractive resource for both memory and I/O. */
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
-       res->base = 0;
-       res->size = 0x1000;
-       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
-       res->base = 0xff800000;
-       res->size = 0x00800000; /* 8 MB for flash */
-       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, 3); /* IOAPIC */
-       res->base = 0xfec00000;
-       res->size = 0x00001000;
-       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-}
-
-static void i82801dbm_lpc_enable_resources(device_t dev)
-{
-       pci_dev_enable_resources(dev);
-       enable_childrens_resources(dev);
-}
-
-static struct device_operations lpc_ops  = {
-       .read_resources   = i82801dbm_lpc_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = i82801dbm_lpc_enable_resources,
-       .init             = lpc_init,
-       .scan_bus         = scan_static_bus,
-       .enable           = i82801dbm_enable,
-};
-
-static const struct pci_driver lpc_driver __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_LPC,
-};
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_nic.c b/src/southbridge/intel/i82801dbm/i82801dbm_nic.c
deleted file mode 100644 (file)
index e25f1bc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-
-static struct device_operations nic_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = 0,
-       .scan_bus         = 0,
-};
-
-static const struct pci_driver nic_driver __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x103a,
-};
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_pci.c b/src/southbridge/intel/i82801dbm/i82801dbm_pci.c
deleted file mode 100644 (file)
index b69cd60..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-static void pci_init(struct device *dev)
-{
-       /* Enable pci error detecting */
-       uint32_t dword;
-       /* System error enable */
-       dword = pci_read_config32(dev, 0x04);
-       dword |= (1<<8); /* SERR# Enable */
-       dword |= (1<<6); /* Parity Error Response */
-       pci_write_config32(dev, 0x04, dword);
-
-}
-
-static struct device_operations pci_ops  = {
-       .read_resources   = pci_bus_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_bus_enable_resources,
-       .init             = pci_init,
-       .scan_bus         = pci_scan_bridge,
-};
-
-static const struct pci_driver pci_driver __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_PCI,
-};
-
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_reset.c b/src/southbridge/intel/i82801dbm/i82801dbm_reset.c
deleted file mode 100644 (file)
index 3d7a4b7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <arch/io.h>
-
-void hard_reset(void)
-{
-        /* Try rebooting through port 0xcf9 */
-        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
-}
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_sata.c b/src/southbridge/intel/i82801dbm/i82801dbm_sata.c
deleted file mode 100644 (file)
index 405ee0e..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-static void sata_init(struct device *dev)
-{
-
-        uint16_t word;
-        uint8_t byte;
-       int enable_c=1, enable_d=1;
-       //      int i;
-                
-        //Enable Serial ATA port
-        byte = pci_read_config8(dev,0x90);
-        byte &= 0xf8;
-        byte |= ICH5_SATA_ADDRESS_MAP & 7;
-        pci_write_config8(dev,0x90,byte);
-
-//        for(i=0;i<10;i++) {
-               word = pci_read_config16(dev,0x92);
-                word &= 0xfffc;
-//                if( (word & 0x0003) == 0x0003) break;
-                word |= 0x0003; // enable P0/P1 
-                pci_write_config16(dev,0x92,word);
-//        }
-
-//        for(i=0;i<10;i++) {
-              /* enable ide0 */
-               word = pci_read_config16(dev, 0x40);
-               word &= ~(1 << 15);
-                if(enable_c==0) {
-//                             if( (word & 0x8000) == 0x0000) break;
-                               word |= 0x0000;
-                }
-                else {
-//                             if( (word & 0x8000) == 0x8000) break;
-                               word |= 0x8000;
-                }
-                pci_write_config16(dev, 0x40, word);
-//     }
-                /* enable ide1 */
-//        for(i=0;i<10;i++) {
-               word = pci_read_config16(dev, 0x42);
-                word &= ~(1 << 15);
-                if(enable_d==0) {
-//                             if( (word & 0x8000) == 0x0000) break;
-                               word |= 0x0000;
-                }
-                else {
-//                             if( (word & 0x8000) == 0x8000) break;
-                               word |= 0x8000;
-                }
-                pci_write_config16(dev, 0x42, word);
-//        }
-
-}
-
-static struct device_operations sata_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = sata_init,
-       .scan_bus         = 0,
-       .enable           = i82801dbm_enable,
-};
-
-static const struct pci_driver stat_driver __pci_driver = {
-       .ops    = &sata_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_SATA,
-};
-
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_smbus.c b/src/southbridge/intel/i82801dbm/i82801dbm_smbus.c
deleted file mode 100644 (file)
index fd06871..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <smbus.h>
-#include <pci.h>
-#include <arch/io.h>
-
-#define PM_BUS 0
-#define PM_DEVFN PCI_DEVFN(0x1f,3)
-
-#define SMBUS_IO_BASE 0x1000
-#define SMBHSTSTAT 0
-#define SMBHSTCTL  2
-#define SMBHSTCMD  3
-#define SMBHSTADD  4
-#define SMBHSTDAT0 5
-#define SMBHSTDAT1 6
-#define SMBBLKDAT  7
-
-void smbus_enable(void)
-{
-       unsigned char byte;
-       /* iobase addr */
-       pcibios_write_config_dword(PM_BUS, PM_DEVFN, 0x20, SMBUS_IO_BASE | 1);
-       /* smbus enable */
-       pcibios_write_config_byte(PM_BUS, PM_DEVFN, 0x40,  1);
-       /* iospace enable */
-       pcibios_write_config_word(PM_BUS, PM_DEVFN, 0x4, 1);
-
-        /* Disable interrupt generation */
-        outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-
-}
-
-void smbus_setup(void)
-{
-       outb(0, SMBUS_IO_BASE + SMBHSTSTAT);
-}
-
-static void smbus_wait_until_ready(void)
-{
-       while((inb(SMBUS_IO_BASE + SMBHSTSTAT) & 1) == 1) {
-               /* nop */
-       }
-}
-
-static void smbus_wait_until_done(void)
-{
-       unsigned char byte;
-       do {
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-       while((byte &1) == 1);
-       while( (byte & ~1) == 0) {
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-}
-
-int smbus_read_byte(unsigned device, unsigned address, unsigned char *result)
-{
-       unsigned char host_status_register;
-       unsigned char byte;
-
-       smbus_wait_until_ready();
-
-       /* setup transaction */
-       /* disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
-       /* set the device I'm talking too */
-       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADD);
-       /* set the command/address... */
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       /* set up for a byte data read */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x2 << 2), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* clear the data byte...*/
-       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* start the command */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* poll for transaction completion */
-       smbus_wait_until_done();
-
-       host_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* read results of transaction */
-       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
-
-       *result = byte;
-       return host_status_register != 0x02;
-}
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_usb.c b/src/southbridge/intel/i82801dbm/i82801dbm_usb.c
deleted file mode 100644 (file)
index 3fd6167..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-static void usb_init(struct device *dev)
-{
-
-
-#if 0
-       uint32_t cmd;
-       printk_debug("USB: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, 
-               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
-               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
-
-
-       printk_debug("done.\n");
-#endif
-
-}
-
-static struct device_operations usb_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = usb_init,
-       .scan_bus         = 0,
-       .enable           = i82801dbm_enable,
-};
-
-static const struct pci_driver usb_driver_1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB1,
-};
-static const struct pci_driver usb_driver_2 __pci_driver = {
-        .ops    = &usb_ops,
-        .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB2,
-};
-static const struct pci_driver usb_driver_3 __pci_driver = {
-        .ops    = &usb_ops,
-        .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB3,
-};
diff --git a/src/southbridge/intel/i82801dbm/i82801dbm_usb2.c b/src/southbridge/intel/i82801dbm/i82801dbm_usb2.c
deleted file mode 100644 (file)
index f05fbbb..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//2003 Copywright Tyan
-
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801dbm.h"
-
-static void usb2_init(struct device *dev)
-{
-
-
-#if 0  
-  uint32_t cmd;
-       printk_debug("USB: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, 
-               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
-               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
-
-
-       printk_debug("done.\n");
-#endif
-}
-
-static struct device_operations usb2_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = usb2_init,
-       .scan_bus         = 0,
-       .enable           = i82801dbm_enable,
-};
-
-static const struct pci_driver usb2_driver __pci_driver = {
-       .ops    = &usb2_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DBM_EHCI,
-};
diff --git a/src/southbridge/intel/i82801dx/Kconfig b/src/southbridge/intel/i82801dx/Kconfig
new file mode 100644 (file)
index 0000000..6a35691
--- /dev/null
@@ -0,0 +1,2 @@
+config SOUTHBRIDGE_INTEL_I82801DX
+       bool
diff --git a/src/southbridge/intel/i82801dx/Makefile.inc b/src/southbridge/intel/i82801dx/Makefile.inc
new file mode 100644 (file)
index 0000000..7167e1d
--- /dev/null
@@ -0,0 +1,9 @@
+driver-y += i82801dx.o
+driver-y += i82801dx_usb.o
+driver-y += i82801dx_lpc.o
+driver-y += i82801dx_ide.o
+driver-y += i82801dx_usb2.o
+driver-y += i82801dx_ac97.o
+#driver-y += i82801dx_nic.o
+#driver-y += i82801dx_pci.o
+obj-y += i82801dx_reset.o
diff --git a/src/southbridge/intel/i82801dx/chip.h b/src/southbridge/intel/i82801dx/chip.h
new file mode 100644 (file)
index 0000000..fdbb7d2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef I82801DX_CHIP_H
+#define I82801DX_CHIP_H
+
+struct southbridge_intel_i82801dx_config 
+{
+       int enable_usb;
+       int enable_native_ide;
+       /**
+        * Interrupt Routing configuration
+        * If bit7 is 1, the interrupt is disabled.
+        */
+       uint8_t pirqa_routing;
+       uint8_t pirqb_routing;
+       uint8_t pirqc_routing;
+       uint8_t pirqd_routing;
+       uint8_t pirqe_routing;
+       uint8_t pirqf_routing;
+       uint8_t pirqg_routing;
+       uint8_t pirqh_routing;
+
+       uint8_t ide0_enable;
+       uint8_t ide1_enable;
+};
+
+extern struct chip_operations southbridge_intel_i82801dx_ops;
+
+#endif /* I82801DBM_CHIP_H */
diff --git a/src/southbridge/intel/i82801dx/cmos_failover.c b/src/southbridge/intel/i82801dx/cmos_failover.c
new file mode 100644 (file)
index 0000000..4821fad
--- /dev/null
@@ -0,0 +1,16 @@
+//kind of cmos_err for ich5
+#define RTC_FAILED    (1 <<2)
+#define GEN_PMCON_3     0xa4
+static void check_cmos_failed(void) 
+{
+
+                uint8_t byte;
+                byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
+                if( byte & RTC_FAILED){
+//clear bit 1 and bit 2
+                        byte = cmos_read(RTC_BOOT_BYTE);
+                        byte &= 0x0c;
+                        byte |= CONFIG_MAX_REBOOT_CNT << 4;
+                        cmos_write(byte, RTC_BOOT_BYTE);
+                }
+}
diff --git a/src/southbridge/intel/i82801dx/i82801dx.c b/src/southbridge/intel/i82801dx/i82801dx.c
new file mode 100644 (file)
index 0000000..abfd8c2
--- /dev/null
@@ -0,0 +1,65 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801dx.h"
+
+void i82801dx_enable(device_t dev)
+{
+       unsigned int index = 0;
+       uint8_t bHasDisableBit = 0;
+       uint16_t cur_disable_mask, new_disable_mask;
+
+//     all 82801dbm devices are in bus 0
+       unsigned int devfn = PCI_DEVFN(0x1f, 0); // lpc
+       device_t lpc_dev = dev_find_slot(0, devfn); // 0
+       if (!lpc_dev)
+               return;
+
+       // Calculate disable bit position for specified device:function
+       // NOTE: For ICH-4, only the following devices can be disabled:
+       //               D31: F0, F1, F3, F5, F6, 
+       //               D29: F0, F1, F2, F7
+
+    if (PCI_SLOT(dev->path.pci.devfn) == 31) {
+       index = PCI_FUNC(dev->path.pci.devfn);
+
+               switch (index) {
+                       case 0:
+                       case 1:
+                       case 3:
+                       case 5:
+                       case 6:
+                               bHasDisableBit = 1;
+                               break;
+                       
+                       default:
+                               break;
+               };
+               
+               if (index == 0)
+                       index = 14;             // D31:F0 bit is an exception
+
+    } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
+       index = 8 + PCI_FUNC(dev->path.pci.devfn);
+
+               if ((PCI_FUNC(dev->path.pci.devfn) < 3) || (PCI_FUNC(dev->path.pci.devfn) == 7))
+                       bHasDisableBit = 1;
+    }
+
+       if (bHasDisableBit) {
+               cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
+               new_disable_mask = cur_disable_mask & ~(1<<index);              // enable it
+               if (!dev->enabled) {
+                       new_disable_mask |= (1<<index);  // disable it
+               }
+               if (new_disable_mask != cur_disable_mask) {
+                       pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
+               }
+       }
+}
+
+struct chip_operations southbridge_intel_i82801dx_ops = {
+       CHIP_NAME("Intel ICH4/ICH4-M (82801Dx) Series Southbridge")
+       .enable_dev = i82801dx_enable,
+};
diff --git a/src/southbridge/intel/i82801dx/i82801dx.h b/src/southbridge/intel/i82801dx/i82801dx.h
new file mode 100644 (file)
index 0000000..d4e1aa0
--- /dev/null
@@ -0,0 +1,163 @@
+/* the problem: we have 82801dbm support in fb1, and 82801er in fb2. 
+ * fb1 code is what we want, fb2 structure is needed however. 
+ * so we need to get fb1 code for 82801dbm into fb2 structure. 
+ */
+/* What I did: took the 80801er stuff from fb2, verify it against the 
+ * db stuff in fb1, and made sure it was right.
+ */
+
+#ifndef I82801DX_H
+#define I82801DX_H
+
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
+#include "chip.h"
+extern void i82801dx_enable(device_t dev);
+#endif
+
+#define MAINBOARD_POWER_OFF    0
+#define MAINBOARD_POWER_ON     1
+#define MAINBOARD_POWER_KEEP   2
+
+#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
+#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
+#endif
+
+/*
+000 = Non-combined. P0 is primary master. P1 is secondary master.
+001 = Non-combined. P0 is secondary master. P1 is primary master.
+100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary; Primary IDE channel
+disabled.
+101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary.
+110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary slave; Secondary IDE
+channel disabled.
+111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master.
+*/
+
+#define PCI_DMA_CFG     0x90
+#define SERIRQ_CNTL     0x64
+#define GEN_CNTL        0xd0
+#define GEN_STS         0xd4
+#define RTC_CONF        0xd8
+#define GEN_PMCON_3     0xa4
+
+#define PCICMD          0x04
+#define PMBASE          0x40
+#define   PMBASE_ADDR  0x0400
+#define ACPI_CNTL       0x44
+#define BIOS_CNTL       0x4E
+#define GPIO_BASE       0x58
+#define GPIO_CNTL       0x5C
+#define PIRQA_ROUT      0x60
+#define PIRQE_ROUT      0x68
+#define COM_DEC         0xE0
+#define LPC_EN          0xE6
+#define FUNC_DIS        0xF2
+
+/* 1e f0 244e */
+
+#define CMD             0x04
+#define SBUS_NUM        0x19
+#define SUB_BUS_NUM     0x1A
+#define SMLT            0x1B
+#define IOBASE          0x1C
+#define IOLIM           0x1D
+#define MEMBASE         0x20
+#define MEMLIM          0x22
+#define CNF             0x50
+#define MTT             0x70
+#define PCI_MAST_STS    0x82
+
+#define RTC_FAILED      (1 <<2)
+
+
+#define SMBUS_IO_BASE 0x1000
+
+#define SMBHSTSTAT 0x0
+#define SMBHSTCTL  0x2
+#define SMBHSTCMD  0x3
+#define SMBXMITADD 0x4
+#define SMBHSTDAT0 0x5
+#define SMBHSTDAT1 0x6
+#define SMBBLKDAT  0x7
+#define SMBTRNSADD 0x9
+#define SMBSLVDATA 0xa
+#define SMLINK_PIN_CTL 0xe
+#define SMBUS_PIN_CTL  0xf 
+
+/* Between 1-10 seconds, We should never timeout normally 
+ * Longer than this is just painful when a timeout condition occurs.
+ */
+#define SMBUS_TIMEOUT (100*1000)
+
+#define PM1_STS                0x00
+#define   WAK_STS      (1 << 15)
+#define   PCIEXPWAK_STS        (1 << 14)
+#define   PRBTNOR_STS  (1 << 11)
+#define   RTC_STS      (1 << 10)
+#define   PWRBTN_STS   (1 << 8)
+#define   GBL_STS      (1 << 5)
+#define   BM_STS       (1 << 4)
+#define   TMROF_STS    (1 << 0)
+#define PM1_EN         0x02
+#define   PCIEXPWAK_DIS        (1 << 14)
+#define   RTC_EN       (1 << 10)
+#define   PWRBTN_EN    (1 << 8)
+#define   GBL_EN       (1 << 5)
+#define   TMROF_EN     (1 << 0)
+#define PM1_CNT                0x04
+#define   SLP_EN       (1 << 13)
+#define   SLP_TYP      (7 << 10)
+#define   GBL_RLS      (1 << 2)
+#define   BM_RLD       (1 << 1)
+#define   SCI_EN       (1 << 0)
+#define PM1_TMR                0x08
+#define PROC_CNT       0x10
+#define LV2            0x14
+#define LV3            0x15
+#define LV4            0x16
+#define PM2_CNT                0x20 // mobile only
+#define GPE0_STS       0x28
+#define   PME_B0_STS   (1 << 13)
+#define   USB3_STS     (1 << 12)
+#define   PME_STS      (1 << 11)
+#define   BATLOW_STS   (1 << 10)
+#define   GST_STS      (1 << 9)
+#define   RI_STS       (1 << 8)
+#define   SMB_WAK_STS  (1 << 7)
+#define   TCOSCI_STS   (1 << 6)
+#define   AC97_STS     (1 << 5)
+#define   USB2_STS     (1 << 4)
+#define   USB1_STS     (1 << 3)
+#define   SWGPE_STS    (1 << 2)
+#define   HOT_PLUG_STS (1 << 1)
+#define   THRM_STS     (1 << 0)
+#define GPE0_EN                0x2c
+#define   PME_B0_EN    (1 << 13)
+#define   PME_EN       (1 << 11)
+#define SMI_EN         0x30
+#define   EL_SMI_EN     (1 << 25) // Intel Quick Resume Technology
+#define   INTEL_USB2_EN         (1 << 18) // Intel-Specific USB2 SMI logic
+#define   LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
+#define   PERIODIC_EN   (1 << 14) // SMI on PERIODIC_STS in SMI_STS
+#define   TCO_EN        (1 << 13) // Enable TCO Logic (BIOSWE et al)
+#define   MCSMI_EN      (1 << 11) // Trap microcontroller range access
+#define   BIOS_RLS      (1 <<  7) // asserts SCI on bit set
+#define   SWSMI_TMR_EN  (1 <<  6) // start software smi timer on bit set
+#define   APMC_EN       (1 <<  5) // Writes to APM_CNT cause SMI#
+#define   SLP_SMI_EN    (1 <<  4) // Write to SLP_EN in PM1_CNT asserts SMI#
+#define   LEGACY_USB_EN  (1 <<  3) // Legacy USB circuit SMI logic
+#define   BIOS_EN       (1 <<  2) // Assert SMI# on setting GBL_RLS bit
+#define   EOS           (1 <<  1) // End of SMI (deassert SMI#)
+#define   GBL_SMI_EN    (1 <<  0) // SMI# generation at all?
+#define SMI_STS                0x34
+#define ALT_GP_SMI_EN  0x38
+#define ALT_GP_SMI_STS 0x3a
+#define GPE_CNTL       0x42
+#define DEVACT_STS     0x44
+#define SS_CNT         0x50
+#define C3_RES         0x54
+
+#define TCOBASE                0x60 /* TCO Base Address Register */
+#define TCO1_CNT       0x08 /* TCO1 Control Register */
+
+#endif /* I82801DX_H */
diff --git a/src/southbridge/intel/i82801dx/i82801dx_ac97.c b/src/southbridge/intel/i82801dx/i82801dx_ac97.c
new file mode 100644 (file)
index 0000000..7524498
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * (C) 2003 Linux Networx
+ */
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+
+static struct device_operations ac97audio_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .enable           = i82801dx_enable,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver ac97audio_driver __pci_driver = {
+       .ops    = &ac97audio_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_AC97_AUDIO,
+};
+
+
+static struct device_operations ac97modem_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .enable           = i82801dx_enable,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver ac97modem_driver __pci_driver = {
+       .ops    = &ac97modem_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_AC97_MODEM,
+};
diff --git a/src/southbridge/intel/i82801dx/i82801dx_early_smbus.c b/src/southbridge/intel/i82801dx/i82801dx_early_smbus.c
new file mode 100644 (file)
index 0000000..0a0ff91
--- /dev/null
@@ -0,0 +1,180 @@
+
+//#define SMBUS_IO_BASE 0x1000
+//#define SMBUS_IO_BASE 0x0f00
+
+#define SMBHSTSTAT 0x0
+#define SMBHSTCTL  0x2
+#define SMBHSTCMD  0x3
+#define SMBXMITADD 0x4
+#define SMBHSTDAT0 0x5
+#define SMBHSTDAT1 0x6
+#define SMBBLKDAT  0x7
+#define SMBTRNSADD 0x9
+#define SMBSLVDATA 0xa
+#define SMLINK_PIN_CTL 0xe
+#define SMBUS_PIN_CTL  0xf 
+
+/* Between 1-10 seconds, We should never timeout normally 
+ * Longer than this is just painful when a timeout condition occurs.
+ */
+//#define SMBUS_TIMEOUT (100*1000*10)
+
+static void enable_smbus(void)
+{
+       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
+
+       print_debug("SMBus controller enabled\r\n");
+       /* set smbus iobase */
+       pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
+       /* Set smbus enable */
+       pci_write_config8(dev, 0x40, 0x01);
+       /* Set smbus iospace enable */ 
+       pci_write_config16(dev, 0x4, 0x01);
+       /* Disable interrupt generation */ 
+       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+}
+
+
+static inline void smbus_delay(void)
+{
+       outb(0x80, 0x80);
+}
+
+static int smbus_wait_until_active(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               if ((val & 1)) {
+                       break;
+               }
+       } while(--loops);
+       return loops?0:-4;
+}
+
+static int smbus_wait_until_ready(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               if ((val & 1) == 0) {
+                       break;
+               }
+               if(loops == (SMBUS_TIMEOUT / 2)) {
+                       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
+                               SMBUS_IO_BASE + SMBHSTSTAT);
+               }
+       } while(--loops);
+       return loops?0:-2;
+}
+
+static int smbus_wait_until_done(void)
+{
+       unsigned long loops;
+       loops = SMBUS_TIMEOUT;
+       do {
+               unsigned char val;
+               smbus_delay();
+               
+               val = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+               if ( (val & 1) == 0) {
+                       break;
+               }
+               if ((val & ~((1<<6)|(1<<0)) ) != 0 ) {
+                       break;
+               }
+       } while(--loops);
+       return loops?0:-3;
+}
+
+static int smbus_read_byte(unsigned device, unsigned address)
+{
+       unsigned char global_control_register;
+       unsigned char global_status_register;
+       unsigned char byte;
+
+       /*print_err("smbus_read_byte\r\n");*/
+       if (smbus_wait_until_ready() < 0) {
+               print_err_hex8(-2);
+               return -2;
+       }
+       
+       /* setup transaction */
+       /* disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xfe, SMBUS_IO_BASE + SMBHSTCTL);
+       /* set the device I'm talking too */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
+       /* set the command/address... */
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       /* set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2<<2), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* clear the data byte...*/
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* start a byte read, with interrupts disabled */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
+       /* poll for it to start */
+       if (smbus_wait_until_active() < 0) {
+               print_err_hex8(-4);
+               return -4;
+       }
+
+       /* poll for transaction completion */
+       if (smbus_wait_until_done() < 0) {
+               print_err_hex8(-3);
+               return -3;
+       }
+
+       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT) & ~(1<<6); /* Ignore the In Use Status... */
+
+       /* read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+
+       if (global_status_register != 2) {
+               print_err_hex8(-1);
+               return -1;
+       }
+/*
+        print_err("smbus_read_byte: ");
+       print_err_hex32(device); print_err(" ad "); print_err_hex32(address);
+       print_err("value "); print_err_hex8(byte); print_err("\r\n");
+ */
+       return byte;
+}
+#if 0
+static void smbus_write_byte(unsigned device, unsigned address, unsigned char val)
+{
+       if (smbus_wait_until_ready() < 0) {
+               return;
+       }
+
+       /* by LYH */
+       outb(0x37,SMBUS_IO_BASE + SMBHSTSTAT);
+       /* set the device I'm talking too */
+       outw(((device & 0x7f) << 1) | 0, SMBUS_IO_BASE + SMBHSTADDR);
+
+       /* data to send */
+       outb(val, SMBUS_IO_BASE + SMBHSTDAT);
+
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+
+       /* start the command */
+       outb(0xa, SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* poll for transaction completion */
+       smbus_wait_until_done();
+       return;
+}
+#endif
diff --git a/src/southbridge/intel/i82801dx/i82801dx_ide.c b/src/southbridge/intel/i82801dx/i82801dx_ide.c
new file mode 100644 (file)
index 0000000..bb35107
--- /dev/null
@@ -0,0 +1,53 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+
+static void ide_init(struct device *dev)
+{
+#if ICH5_SATA_ADDRESS_MAP<=1
+       /* Enable ide devices so the linux ide driver will work */
+       uint16_t word;
+       uint8_t byte;
+       int enable_a=1, enable_b=1;
+
+
+       word = pci_read_config16(dev, 0x40);
+       word &= ~((1 << 15));
+       if (enable_a) {
+               /* Enable first ide interface */
+               word |= (1<<15);
+               printk_debug("IDE0 ");
+       }
+       pci_write_config16(dev, 0x40, word);
+
+        word = pci_read_config16(dev, 0x42);
+        word &= ~((1 << 15));
+        if (enable_b) {
+                /* Enable secondary ide interface */
+                word |= (1<<15);
+                printk_debug("IDE1 ");
+        }
+        pci_write_config16(dev, 0x42, word);
+#endif
+
+}
+
+static struct device_operations ide_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = ide_init,
+       .scan_bus         = 0,
+       .enable           = i82801dx_enable,
+};
+
+static const struct pci_driver ide_driver __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_IDE,
+};
+
diff --git a/src/southbridge/intel/i82801dx/i82801dx_lpc.c b/src/southbridge/intel/i82801dx/i82801dx_lpc.c
new file mode 100644 (file)
index 0000000..59225d2
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * (C) 2003 Linux Networx, SuSE Linux AG
+ * (C) 2004 Tyan Computer
+ */
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include <pc80/mc146818rtc.h>
+#include <pc80/isa-dma.h>
+#include <arch/io.h>
+#include "i82801dx.h"
+
+
+
+#define NMI_OFF 0
+
+void i82801dx_enable_ioapic( struct device *dev) 
+{
+        uint32_t dword;
+        volatile uint32_t *ioapic_sba = (volatile uint32_t *)0xfec00000;
+        volatile uint32_t *ioapic_sbd = (volatile uint32_t *)0xfec00010;
+
+        dword = pci_read_config32(dev, GEN_CNTL);
+        dword |= (3 << 7); /* enable ioapic */
+        dword |= (1 <<13); /* coprocessor error enable */
+        dword |= (1 << 1); /* delay transaction enable */
+        dword |= (1 << 2); /* DMA collection buf enable */
+        pci_write_config32(dev, GEN_CNTL, dword);
+        printk_debug("ioapic southbridge enabled %x\n",dword);
+        *ioapic_sba=0;
+        *ioapic_sbd=(2<<24);
+        //lyh *ioapic_sba=3;
+        //lyh *ioapic_sbd=1;    
+        *ioapic_sba=0;
+        dword=*ioapic_sbd;
+        printk_debug("Southbridge apic id = %x\n",dword);
+        if(dword!=(2<<24))
+                die("");
+        //lyh *ioapic_sba=3;
+        //lyh dword=*ioapic_sbd;
+        //lyh printk_debug("Southbridge apic DT = %x\n",dword);
+        //lyh if(dword!=1)
+        //lyh   die("");
+
+
+}
+void i82801dx_enable_serial_irqs( struct device *dev)
+{
+        pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0<< 0));
+}
+void i82801dx_lpc_route_dma( struct device *dev, uint8_t mask) 
+{
+        uint16_t word;
+        int i;
+        word = pci_read_config16(dev, PCI_DMA_CFG);
+        word &= ((1 << 10) - (1 << 8));
+        for(i = 0; i < 8; i++) {
+                if (i == 4)
+                        continue;
+                word |= ((mask & (1 << i))? 3:1) << (i*2);
+        }
+        pci_write_config16(dev, PCI_DMA_CFG, word);
+}
+void i82801dx_rtc_init(struct device *dev)
+{
+        uint8_t byte;
+        uint32_t dword;
+        int rtc_failed;
+        byte = pci_read_config8(dev, GEN_PMCON_3);
+        rtc_failed = byte & RTC_FAILED;
+        if (rtc_failed) {
+                byte &= ~(1 << 1); /* preserve the power fail state */
+                pci_write_config8(dev, GEN_PMCON_3, byte);
+        }
+        dword = pci_read_config32(dev, GEN_STS);
+        rtc_failed |= dword & (1 << 2);
+        rtc_init(rtc_failed);
+}
+
+
+void i82801dx_1f0_misc(struct device *dev)
+{
+        pci_write_config16(dev, PCICMD, 0x014f);
+        pci_write_config32(dev, PMBASE, 0x00001001);
+        pci_write_config8(dev, ACPI_CNTL, 0x10);
+        pci_write_config32(dev, GPIO_BASE, 0x00001181);
+        pci_write_config8(dev, GPIO_CNTL, 0x10);
+        pci_write_config32(dev, PIRQA_ROUT, 0x0A05030B);
+        pci_write_config8(dev, PIRQE_ROUT, 0x07);
+        pci_write_config8(dev, RTC_CONF, 0x04);
+        pci_write_config8(dev, COM_DEC, 0x10);  //lyh E0->
+        pci_write_config16(dev, LPC_EN, 0x000F);  //LYH 000D->
+}
+
+static void enable_hpet(struct device *dev)
+{
+       const unsigned long hpet_address = 0xfed0000;
+
+        uint32_t dword;
+       uint32_t code = (0 & 0x3);
+        
+        dword = pci_read_config32(dev, GEN_CNTL);
+        dword |= (1 << 17); /* enable hpet */
+       /*Bits [16:15]Memory Address Range
+       00 FED0_0000h - FED0_03FFh
+       01 FED0_1000h - FED0_13FFh
+       10 FED0_2000h - FED0_23FFh
+       11 FED0_3000h - FED0_33FFh*/
+
+        dword &= ~(3 << 15); /* clear it */
+       dword |= (code<<15);
+
+       printk_debug("enabling HPET @0x%x\n", hpet_address | (code <<12) );
+}
+
+static void lpc_init(struct device *dev)
+{
+       uint8_t byte;
+       int pwr_on=-1;
+       int nmi_option;
+
+       /* IO APIC initialization */
+       i82801dx_enable_ioapic(dev);
+
+       i82801dx_enable_serial_irqs(dev);
+
+#ifdef SUSPICIOUS_LOOKING_CODE 
+       // The ICH-4 datasheet does not mention this configuration register. 
+       // This code may have been inherited (incorrectly) from code for the AMD 766 southbridge,
+       // which *does* support this functionality.
+
+       /* posted memory write enable */
+       byte = pci_read_config8(dev, 0x46);
+       pci_write_config8(dev, 0x46, byte | (1<<0)); 
+#endif
+
+       /* power after power fail */
+               /* FIXME this doesn't work! */
+        /* Which state do we want to goto after g3 (power restored)?
+         * 0 == S0 Full On
+         * 1 == S5 Soft Off
+         */
+        pci_write_config8(dev, GEN_PMCON_3, pwr_on?0:1);
+        printk_info("set power %s after power fail\n", pwr_on?"on":"off");
+#if 0
+       /* Enable Error reporting */
+       /* Set up sync flood detected */
+       byte = pci_read_config8(dev, 0x47);
+       byte |= (1 << 1);
+       pci_write_config8(dev, 0x47, byte);
+#endif
+
+       /* Set up NMI on errors */
+    byte = inb(0x61);
+    byte &= ~(1 << 3); /* IOCHK# NMI Enable */
+    byte &= ~(1 << 2); /* PCI SERR# Enable */
+    outb(byte, 0x61);
+    byte = inb(0x70);
+       nmi_option = NMI_OFF;
+       get_option(&nmi_option, "nmi");
+       if (nmi_option) {                       
+        byte &= ~(1 << 7); /* set NMI */
+        outb(byte, 0x70);
+       }
+       
+       /* Initialize the real time clock */
+       i82801dx_rtc_init(dev);
+
+       i82801dx_lpc_route_dma(dev, 0xff);
+
+       /* Initialize isa dma */
+       isa_dma_init();
+
+       i82801dx_1f0_misc(dev);
+       /* Initialize the High Precision Event Timers */
+       enable_hpet(dev);
+}
+
+static void i82801dx_lpc_read_resources(device_t dev)
+{
+       struct resource *res;
+
+       /* Get the normal PCI resources of this device. */
+       pci_dev_read_resources(dev);
+
+       /* Add an extra subtractive resource for both memory and I/O. */
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void i82801dx_lpc_enable_resources(device_t dev)
+{
+       pci_dev_enable_resources(dev);
+       enable_childrens_resources(dev);
+}
+
+static struct device_operations lpc_ops  = {
+       .read_resources   = i82801dx_lpc_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = i82801dx_lpc_enable_resources,
+       .init             = lpc_init,
+       .scan_bus         = scan_static_bus,
+       .enable           = i82801dx_enable,
+};
+
+static const struct pci_driver lpc_driver __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_LPC,
+};
diff --git a/src/southbridge/intel/i82801dx/i82801dx_nic.c b/src/southbridge/intel/i82801dx/i82801dx_nic.c
new file mode 100644 (file)
index 0000000..6221ba4
--- /dev/null
@@ -0,0 +1,21 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+
+static struct device_operations nic_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = 0,
+       .scan_bus         = 0,
+};
+
+static const struct pci_driver nic_driver __pci_driver = {
+       .ops    = &nic_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = 0x103a,
+};
diff --git a/src/southbridge/intel/i82801dx/i82801dx_pci.c b/src/southbridge/intel/i82801dx/i82801dx_pci.c
new file mode 100644 (file)
index 0000000..0c88bf2
--- /dev/null
@@ -0,0 +1,33 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+static void pci_init(struct device *dev)
+{
+       /* Enable pci error detecting */
+       uint32_t dword;
+       /* System error enable */
+       dword = pci_read_config32(dev, 0x04);
+       dword |= (1<<8); /* SERR# Enable */
+       dword |= (1<<6); /* Parity Error Response */
+       pci_write_config32(dev, 0x04, dword);
+
+}
+
+static struct device_operations pci_ops  = {
+       .read_resources   = pci_bus_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_bus_enable_resources,
+       .init             = pci_init,
+       .scan_bus         = pci_scan_bridge,
+};
+
+static const struct pci_driver pci_driver __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_PCI,
+};
+
diff --git a/src/southbridge/intel/i82801dx/i82801dx_reset.c b/src/southbridge/intel/i82801dx/i82801dx_reset.c
new file mode 100644 (file)
index 0000000..3d7a4b7
--- /dev/null
@@ -0,0 +1,7 @@
+#include <arch/io.h>
+
+void hard_reset(void)
+{
+        /* Try rebooting through port 0xcf9 */
+        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
+}
diff --git a/src/southbridge/intel/i82801dx/i82801dx_sata.c b/src/southbridge/intel/i82801dx/i82801dx_sata.c
new file mode 100644 (file)
index 0000000..22c6cd7
--- /dev/null
@@ -0,0 +1,75 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+static void sata_init(struct device *dev)
+{
+
+        uint16_t word;
+        uint8_t byte;
+       int enable_c=1, enable_d=1;
+       //      int i;
+                
+        //Enable Serial ATA port
+        byte = pci_read_config8(dev,0x90);
+        byte &= 0xf8;
+        byte |= ICH5_SATA_ADDRESS_MAP & 7;
+        pci_write_config8(dev,0x90,byte);
+
+//        for(i=0;i<10;i++) {
+               word = pci_read_config16(dev,0x92);
+                word &= 0xfffc;
+//                if( (word & 0x0003) == 0x0003) break;
+                word |= 0x0003; // enable P0/P1 
+                pci_write_config16(dev,0x92,word);
+//        }
+
+//        for(i=0;i<10;i++) {
+              /* enable ide0 */
+               word = pci_read_config16(dev, 0x40);
+               word &= ~(1 << 15);
+                if(enable_c==0) {
+//                             if( (word & 0x8000) == 0x0000) break;
+                               word |= 0x0000;
+                }
+                else {
+//                             if( (word & 0x8000) == 0x8000) break;
+                               word |= 0x8000;
+                }
+                pci_write_config16(dev, 0x40, word);
+//     }
+                /* enable ide1 */
+//        for(i=0;i<10;i++) {
+               word = pci_read_config16(dev, 0x42);
+                word &= ~(1 << 15);
+                if(enable_d==0) {
+//                             if( (word & 0x8000) == 0x0000) break;
+                               word |= 0x0000;
+                }
+                else {
+//                             if( (word & 0x8000) == 0x8000) break;
+                               word |= 0x8000;
+                }
+                pci_write_config16(dev, 0x42, word);
+//        }
+
+}
+
+static struct device_operations sata_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = sata_init,
+       .scan_bus         = 0,
+       .enable           = i82801dx_enable,
+};
+
+static const struct pci_driver stat_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_SATA,
+};
+
diff --git a/src/southbridge/intel/i82801dx/i82801dx_smbus.c b/src/southbridge/intel/i82801dx/i82801dx_smbus.c
new file mode 100644 (file)
index 0000000..e56a67c
--- /dev/null
@@ -0,0 +1,95 @@
+#include "i82801dx.h"
+#include <smbus.h>
+#include <pci.h>
+#include <arch/io.h>
+
+#define PM_BUS 0
+#define PM_DEVFN PCI_DEVFN(0x1f,3)
+
+#if 0
+#define SMBUS_IO_BASE 0x1000
+#define SMBHSTSTAT 0
+#define SMBHSTCTL  2
+#define SMBHSTCMD  3
+#define SMBHSTADD  4
+#define SMBHSTDAT0 5
+#define SMBHSTDAT1 6
+#define SMBBLKDAT  7
+#endif
+
+void smbus_enable(void)
+{
+       unsigned char byte;
+       /* iobase addr */
+       pcibios_write_config_dword(PM_BUS, PM_DEVFN, 0x20, SMBUS_IO_BASE | 1);
+       /* smbus enable */
+       pcibios_write_config_byte(PM_BUS, PM_DEVFN, 0x40,  1);
+       /* iospace enable */
+       pcibios_write_config_word(PM_BUS, PM_DEVFN, 0x4, 1);
+
+        /* Disable interrupt generation */
+        outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+
+}
+
+void smbus_setup(void)
+{
+       outb(0, SMBUS_IO_BASE + SMBHSTSTAT);
+}
+
+static void smbus_wait_until_ready(void)
+{
+       while((inb(SMBUS_IO_BASE + SMBHSTSTAT) & 1) == 1) {
+               /* nop */
+       }
+}
+
+static void smbus_wait_until_done(void)
+{
+       unsigned char byte;
+       do {
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+       while((byte &1) == 1);
+       while( (byte & ~1) == 0) {
+               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+}
+
+int smbus_read_byte(unsigned device, unsigned address, unsigned char *result)
+{
+       unsigned char host_status_register;
+       unsigned char byte;
+
+       smbus_wait_until_ready();
+
+       /* setup transaction */
+       /* disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+       /* set the device I'm talking too */
+       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADD);
+       /* set the command/address... */
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       /* set up for a byte data read */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x2 << 2), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* clear the data byte...*/
+       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
+
+       /* start the command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40), SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* poll for transaction completion */
+       smbus_wait_until_done();
+
+       host_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+
+       /* read results of transaction */
+       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
+
+       *result = byte;
+       return host_status_register != 0x02;
+}
diff --git a/src/southbridge/intel/i82801dx/i82801dx_usb.c b/src/southbridge/intel/i82801dx/i82801dx_usb.c
new file mode 100644 (file)
index 0000000..2e60193
--- /dev/null
@@ -0,0 +1,49 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+static void usb_init(struct device *dev)
+{
+
+
+#if 0
+       uint32_t cmd;
+       printk_debug("USB: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, 
+               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
+               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
+
+
+       printk_debug("done.\n");
+#endif
+
+}
+
+static struct device_operations usb_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = usb_init,
+       .scan_bus         = 0,
+       .enable           = i82801dx_enable,
+};
+
+static const struct pci_driver usb_driver_1 __pci_driver = {
+       .ops    = &usb_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB1,
+};
+static const struct pci_driver usb_driver_2 __pci_driver = {
+        .ops    = &usb_ops,
+        .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB2,
+};
+static const struct pci_driver usb_driver_3 __pci_driver = {
+        .ops    = &usb_ops,
+        .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_USB3,
+};
diff --git a/src/southbridge/intel/i82801dx/i82801dx_usb2.c b/src/southbridge/intel/i82801dx/i82801dx_usb2.c
new file mode 100644 (file)
index 0000000..ca13e92
--- /dev/null
@@ -0,0 +1,40 @@
+//2003 Copywright Tyan
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801dx.h"
+
+static void usb2_init(struct device *dev)
+{
+
+
+#if 0  
+  uint32_t cmd;
+       printk_debug("USB: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, 
+               cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 
+               PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
+
+
+       printk_debug("done.\n");
+#endif
+}
+
+static struct device_operations usb2_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = usb2_init,
+       .scan_bus         = 0,
+       .enable           = i82801dx_enable,
+};
+
+static const struct pci_driver usb2_driver __pci_driver = {
+       .ops    = &usb2_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801DBM_EHCI,
+};
diff --git a/src/southbridge/intel/i82801er/Kconfig b/src/southbridge/intel/i82801er/Kconfig
deleted file mode 100644 (file)
index adb6c1d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-config SOUTHBRIDGE_INTEL_I82801ER
-       bool
-       select IOAPIC
diff --git a/src/southbridge/intel/i82801er/Makefile.inc b/src/southbridge/intel/i82801er/Makefile.inc
deleted file mode 100644 (file)
index b2f81f8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-driver-y += i82801er.o
-driver-y += i82801er_uhci.o
-driver-y += i82801er_lpc.o
-driver-y += i82801er_ide.o
-driver-y += i82801er_sata.o
-driver-y += i82801er_ehci.o
-driver-y += i82801er_smbus.o
-driver-y += i82801er_pci.o
-driver-y += i82801er_ac97.o
-obj-y += i82801er_watchdog.o
-obj-y += i82801er_reset.o
diff --git a/src/southbridge/intel/i82801er/chip.h b/src/southbridge/intel/i82801er/chip.h
deleted file mode 100644 (file)
index eb63889..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef I82801ER_CHIP_H
-#define I82801ER_CHIP_H
-
-struct southbridge_intel_i82801er_config 
-{
-
-#define ICH5R_GPIO_USE_MASK      0x03
-#define ICH5R_GPIO_USE_DEFAULT   0x00
-#define ICH5R_GPIO_USE_AS_NATIVE 0x01
-#define ICH5R_GPIO_USE_AS_GPIO   0x02
-
-#define ICH5R_GPIO_SEL_MASK      0x0c
-#define ICH5R_GPIO_SEL_DEFAULT   0x00
-#define ICH5R_GPIO_SEL_OUTPUT    0x04
-#define ICH5R_GPIO_SEL_INPUT     0x08
-
-#define ICH5R_GPIO_LVL_MASK      0x30
-#define ICH5R_GPIO_LVL_DEFAULT   0x00
-#define ICH5R_GPIO_LVL_LOW       0x10
-#define ICH5R_GPIO_LVL_HIGH      0x20
-#define ICH5R_GPIO_LVL_BLINK     0x30
-
-#define ICH5R_GPIO_INV_MASK      0xc0
-#define ICH5R_GPIO_INV_DEFAULT   0x00
-#define ICH5R_GPIO_INV_OFF       0x40
-#define ICH5R_GPIO_INV_ON        0x80
-
-       /* GPIO use select */
-       unsigned char gpio[64];
-       unsigned int  pirq_a_d;
-       unsigned int  pirq_e_h;
-};
-extern struct chip_operations southbridge_intel_i82801er_ops;
-
-#endif /* I82801ER_CHIP_H */
-
diff --git a/src/southbridge/intel/i82801er/cmos_failover.c b/src/southbridge/intel/i82801er/cmos_failover.c
deleted file mode 100644 (file)
index 4821fad..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-//kind of cmos_err for ich5
-#define RTC_FAILED    (1 <<2)
-#define GEN_PMCON_3     0xa4
-static void check_cmos_failed(void) 
-{
-
-                uint8_t byte;
-                byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
-                if( byte & RTC_FAILED){
-//clear bit 1 and bit 2
-                        byte = cmos_read(RTC_BOOT_BYTE);
-                        byte &= 0x0c;
-                        byte |= CONFIG_MAX_REBOOT_CNT << 4;
-                        cmos_write(byte, RTC_BOOT_BYTE);
-                }
-}
diff --git a/src/southbridge/intel/i82801er/i82801er.c b/src/southbridge/intel/i82801er/i82801er.c
deleted file mode 100644 (file)
index 19b0666..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801er.h"
-
-void i82801er_enable(device_t dev)
-{
-       device_t lpc_dev;
-       unsigned index = 0;
-       uint16_t reg_old, reg;
-
-       /* See if we are behind the i82801er pci bridge */
-       lpc_dev = dev_find_slot(dev->bus->secondary, PCI_DEVFN(0x1f, 0));
-       if((dev->path.pci.devfn &0xf8)== 0xf8) {
-               index = dev->path.pci.devfn & 7;
-       }
-       else if((dev->path.pci.devfn &0xf8)== 0xe8) {
-               index = (dev->path.pci.devfn & 7) +8;
-       }
-       if ((!lpc_dev) || (index >= 16) || ((1<<index)&0x3091)) {
-               return;
-       }
-       if ((lpc_dev->vendor != PCI_VENDOR_ID_INTEL) ||
-               (lpc_dev->device != PCI_DEVICE_ID_INTEL_82801ER_LPC)) {
-               uint32_t id;
-               id = pci_read_config32(lpc_dev, PCI_VENDOR_ID);
-               if (id != (PCI_VENDOR_ID_INTEL | 
-                               (PCI_DEVICE_ID_INTEL_82801ER_LPC << 16))) {
-                       return;
-               }
-       }
-
-       reg = reg_old = pci_read_config16(lpc_dev, 0xf2);
-       reg &= ~(1 << index);
-       if (!dev->enabled) {
-               reg |= (1 << index);
-       }
-       if (reg != reg_old) {
-               pci_write_config16(lpc_dev, 0xf2, reg);
-       }
-       
-}
-
-struct chip_operations southbridge_intel_i82801er_ops = {
-       CHIP_NAME("Intel 82801ER Southbridge")
-       .enable_dev = i82801er_enable,
-};
diff --git a/src/southbridge/intel/i82801er/i82801er.h b/src/southbridge/intel/i82801er/i82801er.h
deleted file mode 100644 (file)
index bd74101..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef I82801ER_H
-#define I82801ER_H
-
-#include "chip.h"
-
-extern void i82801er_enable(device_t dev);
-
-#define PCI_DMA_CFG     0x90
-#define SERIRQ_CNTL     0x64
-#define GEN_CNTL        0xd0
-#define GEN_STS         0xd4
-#define RTC_CONF        0xd8
-#define GEN_PMCON_3     0xa4
-
-#endif /* I82801ER_H */
diff --git a/src/southbridge/intel/i82801er/i82801er_ac97.c b/src/southbridge/intel/i82801er/i82801er_ac97.c
deleted file mode 100644 (file)
index 0525a5e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void ac97_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       /* Write the subsystem vendor and device id */
-       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
-               ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = ac97_set_subsystem,
-};
-static struct device_operations ac97_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = 0,
-       .scan_bus         = 0,
-       .enable           = i82801er_enable,
-       .ops_pci          = &lops_pci,
-};
-
-static const struct pci_driver ac97_audio_driver __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_AC97_AUDIO,
-};
-static const struct pci_driver ac97_modem_driver __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_AC97_MODEM,
-};
diff --git a/src/southbridge/intel/i82801er/i82801er_early_smbus.c b/src/southbridge/intel/i82801er/i82801er_early_smbus.c
deleted file mode 100644 (file)
index 42a5568..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-#include "i82801er_smbus.h"
-
-#define SMBUS_IO_BASE 0x0f00
-
-static void enable_smbus(void)
-{
-       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
-
-       print_spew("SMBus controller enabled\r\n");
-
-       pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
-       print_debug_hex32(pci_read_config32(dev, 0x20));
-       /* Set smbus enable */
-       pci_write_config8(dev, 0x40, 1);
-       /* Set smbus iospace enable */
-       pci_write_config8(dev, 0x4, 1);
-       /* SMBALERT_DIS */
-       pci_write_config8(dev, 0x11, 4);
-
-       /* Disable interrupt generation */
-       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-}
-
-static int smbus_read_byte(unsigned device, unsigned address)
-{
-       return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
-}
-
-static void smbus_write_byte(unsigned device, unsigned address, unsigned char val)
-{
-       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
-               return;
-       }
-       
-       print_debug("Unimplemented smbus_write_byte() called.\r\n");
-
-#if 0
-       /* setup transaction */
-       /* disable interrupts */
-       outw(inw(SMBUS_IO_BASE + SMBGCTL) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)),
-                       SMBUS_IO_BASE + SMBGCTL);
-       /* set the device I'm talking too */
-       outw(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADDR);
-       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       /* set up for a byte data write */ /* FIXME */
-       outw((inw(SMBUS_IO_BASE + SMBGCTL) & ~7) | (0x1), SMBUS_IO_BASE + SMBGCTL);
-       /* clear any lingering errors, so the transaction will run */
-       /* Do I need to write the bits to a 1 to clear an error? */
-       outw(inw(SMBUS_IO_BASE + SMBGSTATUS), SMBUS_IO_BASE + SMBGSTATUS);
-
-       /* clear the data word...*/
-       outw(val, SMBUS_IO_BASE + SMBHSTDAT);
-
-       /* start the command */
-       outw((inw(SMBUS_IO_BASE + SMBGCTL) | (1 << 3)), SMBUS_IO_BASE + SMBGCTL);
-
-       /* poll for transaction completion */
-       smbus_wait_until_done(SMBUS_IO_BASE);
-#endif 
-       return;
-}
-
-static int smbus_write_block(unsigned device, unsigned length, unsigned cmd, 
-                unsigned data1, unsigned data2)
-{
-       unsigned char global_control_register;
-       unsigned char global_status_register;
-       unsigned char byte;
-       unsigned char stat;
-       int i;
-
-       /* chear the PM timeout flags, SECOND_TO_STS */
-       outw(inw(0x0400 + 0x66), 0x0400 + 0x66);
-       
-       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
-               return -2;
-       }
-       
-       /* setup transaction */
-       /* Obtain ownership */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-       for(stat=0;(stat&0x40)==0;) {
-       stat = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-       /* clear the done bit */
-       outb(0x80, SMBUS_IO_BASE + SMBHSTSTAT);
-       /* disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
-       
-       /* set the device I'm talking too */
-       outb(((device & 0x7f) << 1), SMBUS_IO_BASE + SMBXMITADD);
-       
-       /* set the command address */
-       outb(cmd & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
-       
-       /* set the block length */
-       outb(length & 0xFF, SMBUS_IO_BASE + SMBHSTDAT0);
-       
-       /* try sending out the first byte of data here */
-       byte=(data1>>(0))&0x0ff;
-       outb(byte,SMBUS_IO_BASE + SMBBLKDAT);
-       /* issue a block write command */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x5 << 2) | 0x40, 
-                       SMBUS_IO_BASE + SMBHSTCTL);
-
-       for(i=0;i<length;i++) {
-               
-               /* poll for transaction completion */
-               if (smbus_wait_until_blk_done(SMBUS_IO_BASE) < 0) {
-                       return -3;
-               }
-               
-               /* load the next byte */
-               if(i>3)
-                       byte=(data2>>(i%4))&0x0ff;
-               else
-                       byte=(data1>>(i))&0x0ff;
-               outb(byte,SMBUS_IO_BASE + SMBBLKDAT);
-               
-               /* clear the done bit */
-               outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
-                               SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-
-       print_debug("SMBUS Block complete\r\n");
-       return 0;
-}
-
diff --git a/src/southbridge/intel/i82801er/i82801er_ehci.c b/src/southbridge/intel/i82801er/i82801er_ehci.c
deleted file mode 100644 (file)
index 47b18de..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void ehci_init(struct device *dev)
-{
-       uint32_t cmd;
-
-       printk_debug("EHCI: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, 
-               cmd | PCI_COMMAND_MASTER);
-
-       printk_debug("done.\n");
-}
-
-static void ehci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       uint8_t access_cntl;
-       access_cntl = pci_read_config8(dev, 0x80);
-       /* Enable writes to protected registers */
-       pci_write_config8(dev, 0x80, access_cntl | 1);
-       /* Write the subsystem vendor and device id */
-       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
-               ((device & 0xffff) << 16) | (vendor & 0xffff));
-       /* Restore protection */
-       pci_write_config8(dev, 0x80, access_cntl);
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = &ehci_set_subsystem,
-};
-static struct device_operations ehci_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = ehci_init,
-       .scan_bus         = 0,
-       .enable           = i82801er_enable,
-       .ops_pci          = &lops_pci,
-};
-
-static const struct pci_driver ehci_driver __pci_driver = {
-       .ops    = &ehci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_EHCI,
-};
diff --git a/src/southbridge/intel/i82801er/i82801er_ide.c b/src/southbridge/intel/i82801er/i82801er_ide.c
deleted file mode 100644 (file)
index 8d8e391..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void ide_init(struct device *dev)
-{
-       /* Enable IDE devices and timmings */
-       pci_write_config16(dev, 0x40, 0x0a307); // IDE0
-       pci_write_config16(dev, 0x42, 0x0a307); // IDE1
-       pci_write_config8(dev, 0x48, 0x05);
-       pci_write_config16(dev, 0x4a, 0x0101);
-       pci_write_config16(dev, 0x54, 0x5055);
-       printk_debug("IDE Enabled\n");
-}
-
-static void i82801er_ide_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       /* This value is also visible in uchi[0-2] and smbus functions */
-       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
-               ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = i82801er_ide_set_subsystem,
-};
-static struct device_operations ide_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = ide_init,
-       .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
-};
-
-static const struct pci_driver ide_driver __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_IDE,
-};
-
diff --git a/src/southbridge/intel/i82801er/i82801er_lpc.c b/src/southbridge/intel/i82801er/i82801er_lpc.c
deleted file mode 100644 (file)
index 357e181..0000000
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * (C) 2004 Linux Networx
- */
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <pc80/mc146818rtc.h>
-#include <pc80/isa-dma.h>
-#include <arch/io.h>
-#include <arch/ioapic.h>
-#include "i82801er.h"
-
-#define ACPI_BAR 0x40
-#define GPIO_BAR 0x58
-
-#define NMI_OFF 0
-#define MAINBOARD_POWER_OFF 0
-#define MAINBOARD_POWER_ON  1
-
-#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
-#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
-#endif
-
-#define SERIRQ_CNTL 0x64
-static void i82801er_enable_serial_irqs(device_t dev)
-{
-       /* set packet length and toggle silent mode bit */
-       pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0 << 0));
-       pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(0 << 6)|((21 - 17) << 2)|(0 << 0));
-}
-
-#define PCI_DMA_CFG 0x90
-static void i82801er_pci_dma_cfg(device_t dev)
-{
-       /* Set PCI DMA CFG to lpc I/F DMA */
-       pci_write_config16(dev, PCI_DMA_CFG, 0xfcff);
-}
-
-#define LPC_EN 0xe6
-static void i82801er_enable_lpc(device_t dev)
-{
-        /* lpc i/f enable */
-        pci_write_config8(dev, LPC_EN, 0x0d);
-}
-
-typedef struct southbridge_intel_i82801er_config config_t;
-
-static void set_i82801er_gpio_use_sel(
-       device_t dev, struct resource *res, config_t *config)
-{
-       uint32_t gpio_use_sel, gpio_use_sel2;
-       int i;
-
-       gpio_use_sel  = 0x1A003180;
-       gpio_use_sel2 = 0x00000007;
-       for(i = 0; i < 64; i++) {
-               int val;
-               switch(config->gpio[i] & ICH5R_GPIO_USE_MASK) {
-               case ICH5R_GPIO_USE_AS_NATIVE: val = 0; break;
-               case ICH5R_GPIO_USE_AS_GPIO:   val = 1; break;
-               default:
-                       continue;
-               }
-               /* The caller is responsible for not playing with unimplemented bits */
-               if (i < 32) {
-                       gpio_use_sel  &= ~( 1 << i);
-                       gpio_use_sel  |= (val << i);
-               } else {
-                       gpio_use_sel2 &= ~( 1 << (i - 32));
-                       gpio_use_sel2 |= (val << (i - 32));
-               }
-       }
-       outl(gpio_use_sel,  res->base + 0x00);
-       outl(gpio_use_sel2, res->base + 0x30);
-}
-
-static void set_i82801er_gpio_direction(
-       device_t dev, struct resource *res, config_t *config)
-{
-       uint32_t gpio_io_sel, gpio_io_sel2;
-       int i;
-
-       gpio_io_sel  = 0x0000ffff;
-       gpio_io_sel2 = 0x00000300;
-       for(i = 0; i < 64; i++) {
-               int val;
-               switch(config->gpio[i] & ICH5R_GPIO_SEL_MASK) {
-               case ICH5R_GPIO_SEL_OUTPUT: val = 0; break;
-               case ICH5R_GPIO_SEL_INPUT:  val = 1; break;
-               default: 
-                       continue;
-               }
-               /* The caller is responsible for not playing with unimplemented bits */
-               if (i < 32) {
-                       gpio_io_sel  &= ~( 1 << i);
-                       gpio_io_sel  |= (val << i);
-               } else {
-                       gpio_io_sel2 &= ~( 1 << (i - 32));
-                       gpio_io_sel2 |= (val << (i - 32));
-               }
-       }
-       outl(gpio_io_sel,  res->base + 0x04);
-       outl(gpio_io_sel2, res->base + 0x34);
-}
-
-static void set_i82801er_gpio_level(
-       device_t dev, struct resource *res, config_t *config)
-{
-       uint32_t gpio_lvl, gpio_lvl2;
-       uint32_t gpio_blink;
-       int i;
-
-       gpio_lvl   = 0x1b3f0000;
-       gpio_blink = 0x00040000;
-       gpio_lvl2  = 0x00030207;
-       for(i = 0; i < 64; i++) {
-               int val, blink;
-               switch(config->gpio[i] & ICH5R_GPIO_LVL_MASK) {
-               case ICH5R_GPIO_LVL_LOW:   val = 0; blink = 0; break;
-               case ICH5R_GPIO_LVL_HIGH:  val = 1; blink = 0; break;
-               case ICH5R_GPIO_LVL_BLINK: val = 1; blink = 1; break;
-               default: 
-                       continue;
-               }
-               /* The caller is responsible for not playing with unimplemented bits */
-               if (i < 32) {
-                       gpio_lvl   &= ~(   1 << i);
-                       gpio_blink &= ~(   1 << i);
-                       gpio_lvl   |= (  val << i);
-                       gpio_blink |= (blink << i);
-               } else {
-                       gpio_lvl2  &= ~( 1 << (i - 32));
-                       gpio_lvl2  |= (val << (i - 32));
-               }
-       }
-       outl(gpio_lvl,   res->base + 0x0c);
-       outl(gpio_blink, res->base + 0x18);
-       outl(gpio_lvl2,  res->base + 0x38);
-}
-
-static void set_i82801er_gpio_inv(
-       device_t dev, struct resource *res, config_t *config)
-{
-       uint32_t gpio_inv;
-       int i;
-
-       gpio_inv   = 0x00000000;
-       for(i = 0; i < 32; i++) {
-               int val;
-               switch(config->gpio[i] & ICH5R_GPIO_INV_MASK) {
-               case ICH5R_GPIO_INV_OFF: val = 0; break;
-               case ICH5R_GPIO_INV_ON:  val = 1; break;
-               default: 
-                       continue;
-               }
-               gpio_inv &= ~( 1 << i);
-               gpio_inv |= (val << i);
-       }
-       outl(gpio_inv,   res->base + 0x2c);
-}
-
-static void i82801er_pirq_init(device_t dev)
-{
-       config_t *config;
-
-       /* Get the chip configuration */
-       config = dev->chip_info;
-
-       if(config->pirq_a_d) {
-               pci_write_config32(dev, 0x60, config->pirq_a_d);
-       }
-       if(config->pirq_e_h) {
-               pci_write_config32(dev, 0x68, config->pirq_e_h);
-       }
-}
-
-
-static void i82801er_gpio_init(device_t dev)
-{
-       struct resource *res;
-       config_t *config;
-
-       /* Skip if I don't have any configuration */
-       if (!dev->chip_info) {
-               return;
-       }
-       /* The programmer is responsible for ensuring
-        * a valid gpio configuration.
-        */
-
-       /* Get the chip configuration */
-       config = dev->chip_info;
-       /* Find the GPIO bar */
-       res = find_resource(dev, GPIO_BAR);
-       if (!res) {
-               return; 
-       }
-
-       /* Set the use selects */
-       set_i82801er_gpio_use_sel(dev, res, config);
-
-       /* Set the IO direction */
-       set_i82801er_gpio_direction(dev, res, config);
-
-       /* Setup the input inverters */
-       set_i82801er_gpio_inv(dev, res, config);
-
-       /* Set the value on the GPIO output pins */
-       set_i82801er_gpio_level(dev, res, config);
-
-}
-
-static void enable_hpet(struct device *dev)
-{
-const unsigned long hpet_address = 0xfed0000;
-
-       uint32_t dword;
-       uint32_t code = (0 & 0x3);
-
-       dword = pci_read_config32(dev, GEN_CNTL);
-       dword |= (1 << 17); /* enable hpet */
-
-       /* Bits [16:15]  Memory Address Range
-        *          00   FED0_0000h - FED0_03FFh
-        *          01   FED0_1000h - FED0_13FFh
-        *          10   FED0_2000h - FED0_23FFh
-        *          11   FED0_3000h - FED0_33FFh
-        */
-
-       dword &= ~(3 << 15); /* clear it */
-       dword |= (code<<15);
-
-       printk_debug("enabling HPET @0x%x\n", hpet_address | (code <<12) );
-}
-
-static void lpc_init(struct device *dev)
-{
-       uint8_t byte;
-       uint32_t value;
-       int pwr_on=CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
-
-       /* IO APIC initialization */
-       value = pci_read_config32(dev, 0xd0);
-       value |= (1 << 8)|(1<<7)|(1<<1);
-       pci_write_config32(dev, 0xd0, value);
-       value = pci_read_config32(dev, 0xd4);
-       value |= (1<<1);
-       pci_write_config32(dev, 0xd4, value);
-       setup_ioapic(IO_APIC_ADDR, 0); // Don't rename IO APIC ID.
-
-       i82801er_enable_serial_irqs(dev);
-
-       i82801er_pci_dma_cfg(dev);
-
-       i82801er_enable_lpc(dev);
-
-       /* Clear SATA to non raid */
-       pci_write_config8(dev, 0xae, 0x00);
-
-        get_option(&pwr_on, "power_on_after_fail");
-       byte = pci_read_config8(dev, 0xa4);
-       byte &= 0xfe;
-       if (!pwr_on) {
-               byte |= 1;
-       }
-       pci_write_config8(dev, 0xa4, byte);
-       printk_info("set power %s after power fail\n", pwr_on?"on":"off");
-
-       /* Set up the PIRQ */
-       i82801er_pirq_init(dev);
-       
-       /* Set the state of the gpio lines */
-       i82801er_gpio_init(dev);
-
-       /* Initialize the real time clock */
-       rtc_init(0);
-
-       /* Initialize isa dma */
-       isa_dma_init();
-
-       /* Disable IDE (needed when sata is enabled) */
-       pci_write_config8(dev, 0xf2, 0x60);
-       
-       enable_hpet(dev);
-}
-
-static void i82801er_lpc_read_resources(device_t dev)
-{
-       struct resource *res;
-
-       /* Get the normal PCI resources of this device. */
-       pci_dev_read_resources(dev);
-
-       /* Add the ACPI BAR */
-       res = pci_get_resource(dev, ACPI_BAR);
-
-       /* Add the GPIO BAR */
-       res = pci_get_resource(dev, GPIO_BAR);
-
-       /* Add an extra subtractive resource for both memory and I/O. */
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
-       res->base = 0;
-       res->size = 0x1000;
-       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
-       res->base = 0xff800000;
-       res->size = 0x00800000; /* 8 MB for flash */
-       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, 3); /* IOAPIC */
-       res->base = 0xfec00000;
-       res->size = 0x00001000;
-       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-}
-
-static void i82801er_lpc_enable_resources(device_t dev)
-{
-       uint8_t acpi_cntl, gpio_cntl;
-
-       /* Enable the normal pci resources */
-       pci_dev_enable_resources(dev);
-
-       /* Enable the ACPI bar */
-       acpi_cntl = pci_read_config8(dev, 0x44);
-       acpi_cntl |= (1 << 4);
-       pci_write_config8(dev, 0x44, acpi_cntl);
-       
-       /* Enable the GPIO bar */
-       gpio_cntl = pci_read_config8(dev, 0x5c);
-       gpio_cntl |= (1 << 4);
-       pci_write_config8(dev, 0x5c, gpio_cntl);
-
-       enable_childrens_resources(dev);
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = 0,
-};
-
-static struct device_operations lpc_ops  = {
-       .read_resources   = i82801er_lpc_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = i82801er_lpc_enable_resources,
-       .init             = lpc_init,
-       .scan_bus         = scan_static_bus,
-       .enable           = i82801er_enable,
-       .ops_pci          = &lops_pci,
-};
-
-static const struct pci_driver lpc_driver __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_LPC,
-};
diff --git a/src/southbridge/intel/i82801er/i82801er_pci.c b/src/southbridge/intel/i82801er/i82801er_pci.c
deleted file mode 100644 (file)
index 6aa578f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void pci_init(struct device *dev)
-{
-       uint32_t dword;
-       uint16_t word;
-
-       /* Clear system errors */
-       word = pci_read_config16(dev, 0x06);
-       word |= 0xf900; /* Clear possible errors */
-       pci_write_config16(dev, 0x06, word);
-
-#if 0
-       /* System error enable */
-       dword = pci_read_config32(dev, 0x04);
-       dword |= (1<<8); /* SERR# Enable */
-       dword |= (1<<6); /* Parity Error Response */
-       pci_write_config32(dev, 0x04, dword);
-#endif                         
-       
-       word = pci_read_config16(dev, 0x1e);
-       word |= 0xf800; /* Clear possible errors */
-       pci_write_config16(dev, 0x1e, word);
-}
-
-static struct device_operations pci_ops  = {
-       .read_resources   = pci_bus_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_bus_enable_resources,
-       .init             = pci_init,
-       .scan_bus         = pci_scan_bridge,
-       .ops_pci          = 0,
-};
-
-static const struct pci_driver pci_driver __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_PCI,
-};
-
diff --git a/src/southbridge/intel/i82801er/i82801er_reset.c b/src/southbridge/intel/i82801er/i82801er_reset.c
deleted file mode 100644 (file)
index fa41756..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <arch/io.h>
-
-void i82801er_hard_reset(void)
-{
-        /* Try rebooting through port 0xcf9 */
-        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
-}
diff --git a/src/southbridge/intel/i82801er/i82801er_sata.c b/src/southbridge/intel/i82801er/i82801er_sata.c
deleted file mode 100644 (file)
index c710d83..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void sata_init(struct device *dev)
-{
-
-       uint16_t word;
-
-  printk_debug("SATA init\n");
-       /* SATA configuration */
-       pci_write_config8(dev, 0x04, 0x07);
-       pci_write_config8(dev, 0x09, 0x8f);
-       
-       /* Set timmings */
-       pci_write_config16(dev, 0x40, 0x0a307);
-       pci_write_config16(dev, 0x42, 0x0a307);
-
-       /* Sync DMA */
-       pci_write_config16(dev, 0x48, 0x000f);
-       pci_write_config16(dev, 0x4a, 0x1111);
-
-       /* 66 mhz */
-       pci_write_config16(dev, 0x54, 0xf00f);
-
-       /* Combine ide - sata configuration */
-       pci_write_config8(dev, 0x90, 0x0);
-       
-       /* port 0 & 1 enable */
-       pci_write_config8(dev, 0x92, 0x33);
-       
-       /* initialize SATA  */
-       pci_write_config16(dev, 0xa0, 0x0018);
-       pci_write_config32(dev, 0xa4, 0x00000264);
-       pci_write_config16(dev, 0xa0, 0x0040);
-       pci_write_config32(dev, 0xa4, 0x00220043);
-
-}
-
-static struct device_operations sata_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = sata_init,
-       .scan_bus         = 0,
-       .ops_pci          = 0,
-};
-
-static const struct pci_driver sata_driver __pci_driver = {
-       .ops    = &sata_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_SATA,
-};
-
-static const struct pci_driver sata_driver_nr __pci_driver = {
-       .ops    = &sata_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_SATA,
-};
-
diff --git a/src/southbridge/intel/i82801er/i82801er_smbus.c b/src/southbridge/intel/i82801er/i82801er_smbus.c
deleted file mode 100644 (file)
index ee32c69..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <device/device.h>
-#include <device/path.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <device/smbus.h>
-#include <arch/io.h>
-#include "i82801er.h"
-#include "i82801er_smbus.h"
-
-static int lsmbus_read_byte(struct bus *bus, device_t dev, uint8_t address)
-{
-       unsigned device;
-       struct resource *res;
-
-       device = dev->path.i2c.device;
-       res = find_resource(bus->dev, 0x20);
-       
-       return do_smbus_read_byte(res->base, device, address);
-}
-
-static struct smbus_bus_operations lops_smbus_bus = {
-       .read_byte  = lsmbus_read_byte,
-};
-static struct pci_operations lops_pci = {
-       /* The subsystem id follows the ide controller */
-       .set_subsystem = 0,
-};
-static struct device_operations smbus_ops = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = 0,
-       .scan_bus         = scan_static_bus,
-       .enable           = i82801er_enable,
-       .ops_pci          = &lops_pci,
-       .ops_smbus_bus    = &lops_smbus_bus,
-};
-
-static const struct pci_driver smbus_driver __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_SMB,
-};
-
diff --git a/src/southbridge/intel/i82801er/i82801er_smbus.h b/src/southbridge/intel/i82801er/i82801er_smbus.h
deleted file mode 100644 (file)
index 861230e..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#include <device/smbus_def.h>
-
-#define SMBHSTSTAT 0x0
-#define SMBHSTCTL  0x2
-#define SMBHSTCMD  0x3
-#define SMBXMITADD 0x4
-#define SMBHSTDAT0 0x5
-#define SMBHSTDAT1 0x6
-#define SMBBLKDAT  0x7
-#define SMBTRNSADD 0x9
-#define SMBSLVDATA 0xa
-#define SMLINK_PIN_CTL 0xe
-#define SMBUS_PIN_CTL  0xf 
-
-#define SMBUS_TIMEOUT (100*1000*10)
-
-
-static void smbus_delay(void)
-{
-       outb(0x80, 0x80);
-}
-
-static int smbus_wait_until_ready(unsigned smbus_io_base)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                       break;
-               byte = inb(smbus_io_base + SMBHSTSTAT);
-       } while(byte & 1);
-       return loops?0:-1;
-}
-
-static int smbus_wait_until_done(unsigned smbus_io_base)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                      break;
-               byte = inb(smbus_io_base + SMBHSTSTAT);
-       } while((byte & 1) || (byte & ~((1<<6)|(1<<0))) == 0);
-       return loops?0:-1;
-}
-
-static int smbus_wait_until_blk_done(unsigned smbus_io_base)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                      break;
-               byte = inb(smbus_io_base + SMBHSTSTAT);
-       } while((byte&(1<<7)) == 0);
-       return loops?0:-1;
-}
-
-static int do_smbus_read_byte(unsigned smbus_io_base, unsigned device, unsigned address)
-{
-       unsigned char global_status_register;
-       unsigned char byte;
-
-       if (smbus_wait_until_ready(smbus_io_base) < 0) {
-               return SMBUS_WAIT_UNTIL_READY_TIMEOUT;
-       }
-       /* setup transaction */
-       /* disable interrupts */
-       outb(inb(smbus_io_base + SMBHSTCTL) & (~1), smbus_io_base + SMBHSTCTL);
-       /* set the device I'm talking too */
-       outb(((device & 0x7f) << 1) | 1, smbus_io_base + SMBXMITADD);
-       /* set the command/address... */
-       outb(address & 0xFF, smbus_io_base + SMBHSTCMD);
-       /* set up for a byte data read */
-       outb((inb(smbus_io_base + SMBHSTCTL) & 0xE3) | (0x2 << 2), smbus_io_base + SMBHSTCTL);
-       /* clear any lingering errors, so the transaction will run */
-       outb(inb(smbus_io_base + SMBHSTSTAT), smbus_io_base + SMBHSTSTAT);
-
-       /* clear the data byte...*/
-       outb(0, smbus_io_base + SMBHSTDAT0);
-
-       /* start the command */
-       outb((inb(smbus_io_base + SMBHSTCTL) | 0x40), smbus_io_base + SMBHSTCTL);
-
-       /* poll for transaction completion */
-       if (smbus_wait_until_done(smbus_io_base) < 0) {
-               return SMBUS_WAIT_UNTIL_DONE_TIMEOUT;
-       }
-
-       global_status_register = inb(smbus_io_base + SMBHSTSTAT);
-
-       /* Ignore the In Use Status... */
-       global_status_register &= ~(3 << 5);
-
-       /* read results of transaction */
-       byte = inb(smbus_io_base + SMBHSTDAT0);
-       if (global_status_register != (1 << 1)) {
-               return SMBUS_ERROR;
-       }
-       return byte;
-}
-
diff --git a/src/southbridge/intel/i82801er/i82801er_uhci.c b/src/southbridge/intel/i82801er/i82801er_uhci.c
deleted file mode 100644 (file)
index c0f4231..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "i82801er.h"
-
-static void uhci_init(struct device *dev)
-{
-       uint32_t cmd;
-
-#if 1
-       printk_debug("UHCI: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, 
-               cmd | PCI_COMMAND_MASTER);
-
-
-       printk_debug("done.\n");
-#endif
-
-}
-
-static struct pci_operations lops_pci = {
-       /* The subsystem id follows the ide controller */
-       .set_subsystem = 0,
-};
-
-static struct device_operations uhci_ops  = {
-       .read_resources   = pci_dev_read_resources,
-       .set_resources    = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .init             = uhci_init,
-       .scan_bus         = 0,
-       .enable           = i82801er_enable,
-       .ops_pci          = &lops_pci,
-};
-
-static const struct pci_driver uhci_driver __pci_driver = {
-       .ops    = &uhci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_USB1,
-};
-
-static const struct pci_driver usb2_driver __pci_driver = {
-       .ops    = &uhci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_USB2,
-};
-
-static const struct pci_driver usb3_driver __pci_driver = {
-       .ops    = &uhci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801ER_USB3,
-};
-
diff --git a/src/southbridge/intel/i82801er/i82801er_watchdog.c b/src/southbridge/intel/i82801er/i82801er_watchdog.c
deleted file mode 100644 (file)
index c9c09f5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <console/console.h>
-#include <arch/io.h>
-#include <device/device.h>
-#include <device/pci.h>
-
-void watchdog_off(void)
-{
-        device_t dev;
-        unsigned long value,base;
-
-       /* turn off the ICH5 watchdog */
-        dev = dev_find_slot(0, PCI_DEVFN(0x1f,0));
-        /* Enable I/O space */
-        value = pci_read_config16(dev, 0x04);
-        value |= (1 << 10);
-        pci_write_config16(dev, 0x04, value);
-        /* Get TCO base */
-        base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
-        /* Disable the watchdog timer */
-        value = inw(base + 0x08);
-        value |= 1 << 11;
-        outw(value, base + 0x08);
-        /* Clear TCO timeout status */
-        outw(0x0008, base + 0x04);
-        outw(0x0002, base + 0x06);
-        printk_debug("Watchdog ICH5 disabled\r\n");
-}
-
diff --git a/src/southbridge/intel/i82801ex/Kconfig b/src/southbridge/intel/i82801ex/Kconfig
new file mode 100644 (file)
index 0000000..905af26
--- /dev/null
@@ -0,0 +1,3 @@
+config SOUTHBRIDGE_INTEL_I82801EX
+       bool
+       select IOAPIC
diff --git a/src/southbridge/intel/i82801ex/Makefile.inc b/src/southbridge/intel/i82801ex/Makefile.inc
new file mode 100644 (file)
index 0000000..66a217b
--- /dev/null
@@ -0,0 +1,11 @@
+driver-y += i82801ex.o
+driver-y += i82801ex_uhci.o
+driver-y += i82801ex_lpc.o
+driver-y += i82801ex_ide.o
+driver-y += i82801ex_sata.o
+driver-y += i82801ex_ehci.o
+driver-y += i82801ex_smbus.o
+driver-y += i82801ex_pci.o
+driver-y += i82801ex_ac97.o
+obj-y += i82801ex_watchdog.o
+obj-y += i82801ex_reset.o
diff --git a/src/southbridge/intel/i82801ex/chip.h b/src/southbridge/intel/i82801ex/chip.h
new file mode 100644 (file)
index 0000000..34a0a97
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef I82801EX_CHIP_H
+#define I82801EX_CHIP_H
+
+struct southbridge_intel_i82801ex_config 
+{
+
+#define ICH5R_GPIO_USE_MASK      0x03
+#define ICH5R_GPIO_USE_DEFAULT   0x00
+#define ICH5R_GPIO_USE_AS_NATIVE 0x01
+#define ICH5R_GPIO_USE_AS_GPIO   0x02
+
+#define ICH5R_GPIO_SEL_MASK      0x0c
+#define ICH5R_GPIO_SEL_DEFAULT   0x00
+#define ICH5R_GPIO_SEL_OUTPUT    0x04
+#define ICH5R_GPIO_SEL_INPUT     0x08
+
+#define ICH5R_GPIO_LVL_MASK      0x30
+#define ICH5R_GPIO_LVL_DEFAULT   0x00
+#define ICH5R_GPIO_LVL_LOW       0x10
+#define ICH5R_GPIO_LVL_HIGH      0x20
+#define ICH5R_GPIO_LVL_BLINK     0x30
+
+#define ICH5R_GPIO_INV_MASK      0xc0
+#define ICH5R_GPIO_INV_DEFAULT   0x00
+#define ICH5R_GPIO_INV_OFF       0x40
+#define ICH5R_GPIO_INV_ON        0x80
+
+       /* GPIO use select */
+       unsigned char gpio[64];
+       unsigned int  pirq_a_d;
+       unsigned int  pirq_e_h;
+};
+extern struct chip_operations southbridge_intel_i82801ex_ops;
+
+#endif /* I82801EX_CHIP_H */
+
diff --git a/src/southbridge/intel/i82801ex/cmos_failover.c b/src/southbridge/intel/i82801ex/cmos_failover.c
new file mode 100644 (file)
index 0000000..4821fad
--- /dev/null
@@ -0,0 +1,16 @@
+//kind of cmos_err for ich5
+#define RTC_FAILED    (1 <<2)
+#define GEN_PMCON_3     0xa4
+static void check_cmos_failed(void) 
+{
+
+                uint8_t byte;
+                byte = pci_read_config8(PCI_DEV(0,0x1f,0),GEN_PMCON_3);
+                if( byte & RTC_FAILED){
+//clear bit 1 and bit 2
+                        byte = cmos_read(RTC_BOOT_BYTE);
+                        byte &= 0x0c;
+                        byte |= CONFIG_MAX_REBOOT_CNT << 4;
+                        cmos_write(byte, RTC_BOOT_BYTE);
+                }
+}
diff --git a/src/southbridge/intel/i82801ex/i82801ex.c b/src/southbridge/intel/i82801ex/i82801ex.c
new file mode 100644 (file)
index 0000000..bc5f04b
--- /dev/null
@@ -0,0 +1,48 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "i82801ex.h"
+
+void i82801ex_enable(device_t dev)
+{
+       device_t lpc_dev;
+       unsigned index = 0;
+       uint16_t reg_old, reg;
+
+       /* See if we are behind the i82801ex pci bridge */
+       lpc_dev = dev_find_slot(dev->bus->secondary, PCI_DEVFN(0x1f, 0));
+       if((dev->path.pci.devfn &0xf8)== 0xf8) {
+               index = dev->path.pci.devfn & 7;
+       }
+       else if((dev->path.pci.devfn &0xf8)== 0xe8) {
+               index = (dev->path.pci.devfn & 7) +8;
+       }
+       if ((!lpc_dev) || (index >= 16) || ((1<<index)&0x3091)) {
+               return;
+       }
+       if ((lpc_dev->vendor != PCI_VENDOR_ID_INTEL) ||
+               (lpc_dev->device != PCI_DEVICE_ID_INTEL_82801ER_LPC)) {
+               uint32_t id;
+               id = pci_read_config32(lpc_dev, PCI_VENDOR_ID);
+               if (id != (PCI_VENDOR_ID_INTEL | 
+                               (PCI_DEVICE_ID_INTEL_82801ER_LPC << 16))) {
+                       return;
+               }
+       }
+
+       reg = reg_old = pci_read_config16(lpc_dev, 0xf2);
+       reg &= ~(1 << index);
+       if (!dev->enabled) {
+               reg |= (1 << index);
+       }
+       if (reg != reg_old) {
+               pci_write_config16(lpc_dev, 0xf2, reg);
+       }
+       
+}
+
+struct chip_operations southbridge_intel_i82801ex_ops = {
+       CHIP_NAME("Intel ICH5 (82801Ex) Series Southbridge")
+       .enable_dev = i82801ex_enable,
+};
diff --git a/src/southbridge/intel/i82801ex/i82801ex.h b/src/southbridge/intel/i82801ex/i82801ex.h
new file mode 100644 (file)
index 0000000..67fecdd
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef I82801EX_H
+#define I82801EX_H
+
+#include "chip.h"
+
+extern void i82801ex_enable(device_t dev);
+
+#define PCI_DMA_CFG     0x90
+#define SERIRQ_CNTL     0x64
+#define GEN_CNTL        0xd0
+#define GEN_STS         0xd4
+#define RTC_CONF        0xd8
+#define GEN_PMCON_3     0xa4
+
+#endif /* I82801EX_H */
diff --git a/src/southbridge/intel/i82801ex/i82801ex_ac97.c b/src/southbridge/intel/i82801ex/i82801ex_ac97.c
new file mode 100644 (file)
index 0000000..65502dd
--- /dev/null
@@ -0,0 +1,37 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void ac97_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+       /* Write the subsystem vendor and device id */
+       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
+               ((device & 0xffff) << 16) | (vendor & 0xffff));
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem = ac97_set_subsystem,
+};
+static struct device_operations ac97_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = 0,
+       .scan_bus         = 0,
+       .enable           = i82801ex_enable,
+       .ops_pci          = &lops_pci,
+};
+
+static const struct pci_driver ac97_audio_driver __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_AC97_AUDIO,
+};
+static const struct pci_driver ac97_modem_driver __pci_driver = {
+       .ops    = &ac97_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_AC97_MODEM,
+};
diff --git a/src/southbridge/intel/i82801ex/i82801ex_early_smbus.c b/src/southbridge/intel/i82801ex/i82801ex_early_smbus.c
new file mode 100644 (file)
index 0000000..c86bf23
--- /dev/null
@@ -0,0 +1,131 @@
+#include "i82801ex_smbus.h"
+
+#define SMBUS_IO_BASE 0x0f00
+
+static void enable_smbus(void)
+{
+       device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
+
+       print_spew("SMBus controller enabled\r\n");
+
+       pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
+       print_debug_hex32(pci_read_config32(dev, 0x20));
+       /* Set smbus enable */
+       pci_write_config8(dev, 0x40, 1);
+       /* Set smbus iospace enable */
+       pci_write_config8(dev, 0x4, 1);
+       /* SMBALERT_DIS */
+       pci_write_config8(dev, 0x11, 4);
+
+       /* Disable interrupt generation */
+       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
+
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+}
+
+static int smbus_read_byte(unsigned device, unsigned address)
+{
+       return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
+}
+
+static void smbus_write_byte(unsigned device, unsigned address, unsigned char val)
+{
+       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
+               return;
+       }
+       
+       print_debug("Unimplemented smbus_write_byte() called.\r\n");
+
+#if 0
+       /* setup transaction */
+       /* disable interrupts */
+       outw(inw(SMBUS_IO_BASE + SMBGCTL) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)),
+                       SMBUS_IO_BASE + SMBGCTL);
+       /* set the device I'm talking too */
+       outw(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBHSTADDR);
+       outb(address & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       /* set up for a byte data write */ /* FIXME */
+       outw((inw(SMBUS_IO_BASE + SMBGCTL) & ~7) | (0x1), SMBUS_IO_BASE + SMBGCTL);
+       /* clear any lingering errors, so the transaction will run */
+       /* Do I need to write the bits to a 1 to clear an error? */
+       outw(inw(SMBUS_IO_BASE + SMBGSTATUS), SMBUS_IO_BASE + SMBGSTATUS);
+
+       /* clear the data word...*/
+       outw(val, SMBUS_IO_BASE + SMBHSTDAT);
+
+       /* start the command */
+       outw((inw(SMBUS_IO_BASE + SMBGCTL) | (1 << 3)), SMBUS_IO_BASE + SMBGCTL);
+
+       /* poll for transaction completion */
+       smbus_wait_until_done(SMBUS_IO_BASE);
+#endif 
+       return;
+}
+
+static int smbus_write_block(unsigned device, unsigned length, unsigned cmd, 
+                unsigned data1, unsigned data2)
+{
+       unsigned char global_control_register;
+       unsigned char global_status_register;
+       unsigned char byte;
+       unsigned char stat;
+       int i;
+
+       /* chear the PM timeout flags, SECOND_TO_STS */
+       outw(inw(0x0400 + 0x66), 0x0400 + 0x66);
+       
+       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
+               return -2;
+       }
+       
+       /* setup transaction */
+       /* Obtain ownership */
+       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
+       for(stat=0;(stat&0x40)==0;) {
+       stat = inb(SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+       /* clear the done bit */
+       outb(0x80, SMBUS_IO_BASE + SMBHSTSTAT);
+       /* disable interrupts */
+       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
+       
+       /* set the device I'm talking too */
+       outb(((device & 0x7f) << 1), SMBUS_IO_BASE + SMBXMITADD);
+       
+       /* set the command address */
+       outb(cmd & 0xFF, SMBUS_IO_BASE + SMBHSTCMD);
+       
+       /* set the block length */
+       outb(length & 0xFF, SMBUS_IO_BASE + SMBHSTDAT0);
+       
+       /* try sending out the first byte of data here */
+       byte=(data1>>(0))&0x0ff;
+       outb(byte,SMBUS_IO_BASE + SMBBLKDAT);
+       /* issue a block write command */
+       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xE3) | (0x5 << 2) | 0x40, 
+                       SMBUS_IO_BASE + SMBHSTCTL);
+
+       for(i=0;i<length;i++) {
+               
+               /* poll for transaction completion */
+               if (smbus_wait_until_blk_done(SMBUS_IO_BASE) < 0) {
+                       return -3;
+               }
+               
+               /* load the next byte */
+               if(i>3)
+                       byte=(data2>>(i%4))&0x0ff;
+               else
+                       byte=(data1>>(i))&0x0ff;
+               outb(byte,SMBUS_IO_BASE + SMBBLKDAT);
+               
+               /* clear the done bit */
+               outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), 
+                               SMBUS_IO_BASE + SMBHSTSTAT);
+       }
+
+       print_debug("SMBUS Block complete\r\n");
+       return 0;
+}
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_ehci.c b/src/southbridge/intel/i82801ex/i82801ex_ehci.c
new file mode 100644 (file)
index 0000000..60b1f30
--- /dev/null
@@ -0,0 +1,50 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void ehci_init(struct device *dev)
+{
+       uint32_t cmd;
+
+       printk_debug("EHCI: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, 
+               cmd | PCI_COMMAND_MASTER);
+
+       printk_debug("done.\n");
+}
+
+static void ehci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+       uint8_t access_cntl;
+       access_cntl = pci_read_config8(dev, 0x80);
+       /* Enable writes to protected registers */
+       pci_write_config8(dev, 0x80, access_cntl | 1);
+       /* Write the subsystem vendor and device id */
+       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
+               ((device & 0xffff) << 16) | (vendor & 0xffff));
+       /* Restore protection */
+       pci_write_config8(dev, 0x80, access_cntl);
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem = &ehci_set_subsystem,
+};
+static struct device_operations ehci_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = ehci_init,
+       .scan_bus         = 0,
+       .enable           = i82801ex_enable,
+       .ops_pci          = &lops_pci,
+};
+
+static const struct pci_driver ehci_driver __pci_driver = {
+       .ops    = &ehci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_EHCI,
+};
diff --git a/src/southbridge/intel/i82801ex/i82801ex_ide.c b/src/southbridge/intel/i82801ex/i82801ex_ide.c
new file mode 100644 (file)
index 0000000..b4d2311
--- /dev/null
@@ -0,0 +1,43 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void ide_init(struct device *dev)
+{
+       /* Enable IDE devices and timmings */
+       pci_write_config16(dev, 0x40, 0x0a307); // IDE0
+       pci_write_config16(dev, 0x42, 0x0a307); // IDE1
+       pci_write_config8(dev, 0x48, 0x05);
+       pci_write_config16(dev, 0x4a, 0x0101);
+       pci_write_config16(dev, 0x54, 0x5055);
+       printk_debug("IDE Enabled\n");
+}
+
+static void i82801ex_ide_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+       /* This value is also visible in uchi[0-2] and smbus functions */
+       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
+               ((device & 0xffff) << 16) | (vendor & 0xffff));
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem = i82801ex_ide_set_subsystem,
+};
+static struct device_operations ide_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = ide_init,
+       .scan_bus         = 0,
+       .ops_pci          = &lops_pci,
+};
+
+static const struct pci_driver ide_driver __pci_driver = {
+       .ops    = &ide_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_IDE,
+};
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_lpc.c b/src/southbridge/intel/i82801ex/i82801ex_lpc.c
new file mode 100644 (file)
index 0000000..6cf8124
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ * (C) 2004 Linux Networx
+ */
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include <pc80/mc146818rtc.h>
+#include <pc80/isa-dma.h>
+#include <arch/io.h>
+#include <arch/ioapic.h>
+#include "i82801ex.h"
+
+#define ACPI_BAR 0x40
+#define GPIO_BAR 0x58
+
+#define NMI_OFF 0
+#define MAINBOARD_POWER_OFF 0
+#define MAINBOARD_POWER_ON  1
+
+#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
+#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
+#endif
+
+#define SERIRQ_CNTL 0x64
+static void i82801ex_enable_serial_irqs(device_t dev)
+{
+       /* set packet length and toggle silent mode bit */
+       pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(1 << 6)|((21 - 17) << 2)|(0 << 0));
+       pci_write_config8(dev, SERIRQ_CNTL, (1 << 7)|(0 << 6)|((21 - 17) << 2)|(0 << 0));
+}
+
+#define PCI_DMA_CFG 0x90
+static void i82801ex_pci_dma_cfg(device_t dev)
+{
+       /* Set PCI DMA CFG to lpc I/F DMA */
+       pci_write_config16(dev, PCI_DMA_CFG, 0xfcff);
+}
+
+#define LPC_EN 0xe6
+static void i82801ex_enable_lpc(device_t dev)
+{
+        /* lpc i/f enable */
+        pci_write_config8(dev, LPC_EN, 0x0d);
+}
+
+typedef struct southbridge_intel_i82801ex_config config_t;
+
+static void set_i82801ex_gpio_use_sel(
+       device_t dev, struct resource *res, config_t *config)
+{
+       uint32_t gpio_use_sel, gpio_use_sel2;
+       int i;
+
+       gpio_use_sel  = 0x1A003180;
+       gpio_use_sel2 = 0x00000007;
+       for(i = 0; i < 64; i++) {
+               int val;
+               switch(config->gpio[i] & ICH5R_GPIO_USE_MASK) {
+               case ICH5R_GPIO_USE_AS_NATIVE: val = 0; break;
+               case ICH5R_GPIO_USE_AS_GPIO:   val = 1; break;
+               default:
+                       continue;
+               }
+               /* The caller is responsible for not playing with unimplemented bits */
+               if (i < 32) {
+                       gpio_use_sel  &= ~( 1 << i);
+                       gpio_use_sel  |= (val << i);
+               } else {
+                       gpio_use_sel2 &= ~( 1 << (i - 32));
+                       gpio_use_sel2 |= (val << (i - 32));
+               }
+       }
+       outl(gpio_use_sel,  res->base + 0x00);
+       outl(gpio_use_sel2, res->base + 0x30);
+}
+
+static void set_i82801ex_gpio_direction(
+       device_t dev, struct resource *res, config_t *config)
+{
+       uint32_t gpio_io_sel, gpio_io_sel2;
+       int i;
+
+       gpio_io_sel  = 0x0000ffff;
+       gpio_io_sel2 = 0x00000300;
+       for(i = 0; i < 64; i++) {
+               int val;
+               switch(config->gpio[i] & ICH5R_GPIO_SEL_MASK) {
+               case ICH5R_GPIO_SEL_OUTPUT: val = 0; break;
+               case ICH5R_GPIO_SEL_INPUT:  val = 1; break;
+               default: 
+                       continue;
+               }
+               /* The caller is responsible for not playing with unimplemented bits */
+               if (i < 32) {
+                       gpio_io_sel  &= ~( 1 << i);
+                       gpio_io_sel  |= (val << i);
+               } else {
+                       gpio_io_sel2 &= ~( 1 << (i - 32));
+                       gpio_io_sel2 |= (val << (i - 32));
+               }
+       }
+       outl(gpio_io_sel,  res->base + 0x04);
+       outl(gpio_io_sel2, res->base + 0x34);
+}
+
+static void set_i82801ex_gpio_level(
+       device_t dev, struct resource *res, config_t *config)
+{
+       uint32_t gpio_lvl, gpio_lvl2;
+       uint32_t gpio_blink;
+       int i;
+
+       gpio_lvl   = 0x1b3f0000;
+       gpio_blink = 0x00040000;
+       gpio_lvl2  = 0x00030207;
+       for(i = 0; i < 64; i++) {
+               int val, blink;
+               switch(config->gpio[i] & ICH5R_GPIO_LVL_MASK) {
+               case ICH5R_GPIO_LVL_LOW:   val = 0; blink = 0; break;
+               case ICH5R_GPIO_LVL_HIGH:  val = 1; blink = 0; break;
+               case ICH5R_GPIO_LVL_BLINK: val = 1; blink = 1; break;
+               default: 
+                       continue;
+               }
+               /* The caller is responsible for not playing with unimplemented bits */
+               if (i < 32) {
+                       gpio_lvl   &= ~(   1 << i);
+                       gpio_blink &= ~(   1 << i);
+                       gpio_lvl   |= (  val << i);
+                       gpio_blink |= (blink << i);
+               } else {
+                       gpio_lvl2  &= ~( 1 << (i - 32));
+                       gpio_lvl2  |= (val << (i - 32));
+               }
+       }
+       outl(gpio_lvl,   res->base + 0x0c);
+       outl(gpio_blink, res->base + 0x18);
+       outl(gpio_lvl2,  res->base + 0x38);
+}
+
+static void set_i82801ex_gpio_inv(
+       device_t dev, struct resource *res, config_t *config)
+{
+       uint32_t gpio_inv;
+       int i;
+
+       gpio_inv   = 0x00000000;
+       for(i = 0; i < 32; i++) {
+               int val;
+               switch(config->gpio[i] & ICH5R_GPIO_INV_MASK) {
+               case ICH5R_GPIO_INV_OFF: val = 0; break;
+               case ICH5R_GPIO_INV_ON:  val = 1; break;
+               default: 
+                       continue;
+               }
+               gpio_inv &= ~( 1 << i);
+               gpio_inv |= (val << i);
+       }
+       outl(gpio_inv,   res->base + 0x2c);
+}
+
+static void i82801ex_pirq_init(device_t dev)
+{
+       config_t *config;
+
+       /* Get the chip configuration */
+       config = dev->chip_info;
+
+       if(config->pirq_a_d) {
+               pci_write_config32(dev, 0x60, config->pirq_a_d);
+       }
+       if(config->pirq_e_h) {
+               pci_write_config32(dev, 0x68, config->pirq_e_h);
+       }
+}
+
+
+static void i82801ex_gpio_init(device_t dev)
+{
+       struct resource *res;
+       config_t *config;
+
+       /* Skip if I don't have any configuration */
+       if (!dev->chip_info) {
+               return;
+       }
+       /* The programmer is responsible for ensuring
+        * a valid gpio configuration.
+        */
+
+       /* Get the chip configuration */
+       config = dev->chip_info;
+       /* Find the GPIO bar */
+       res = find_resource(dev, GPIO_BAR);
+       if (!res) {
+               return; 
+       }
+
+       /* Set the use selects */
+       set_i82801ex_gpio_use_sel(dev, res, config);
+
+       /* Set the IO direction */
+       set_i82801ex_gpio_direction(dev, res, config);
+
+       /* Setup the input inverters */
+       set_i82801ex_gpio_inv(dev, res, config);
+
+       /* Set the value on the GPIO output pins */
+       set_i82801ex_gpio_level(dev, res, config);
+
+}
+
+static void enable_hpet(struct device *dev)
+{
+const unsigned long hpet_address = 0xfed0000;
+
+       uint32_t dword;
+       uint32_t code = (0 & 0x3);
+
+       dword = pci_read_config32(dev, GEN_CNTL);
+       dword |= (1 << 17); /* enable hpet */
+
+       /* Bits [16:15]  Memory Address Range
+        *          00   FED0_0000h - FED0_03FFh
+        *          01   FED0_1000h - FED0_13FFh
+        *          10   FED0_2000h - FED0_23FFh
+        *          11   FED0_3000h - FED0_33FFh
+        */
+
+       dword &= ~(3 << 15); /* clear it */
+       dword |= (code<<15);
+
+       printk_debug("enabling HPET @0x%x\n", hpet_address | (code <<12) );
+}
+
+static void lpc_init(struct device *dev)
+{
+       uint8_t byte;
+       uint32_t value;
+       int pwr_on=CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
+
+       /* IO APIC initialization */
+       value = pci_read_config32(dev, 0xd0);
+       value |= (1 << 8)|(1<<7)|(1<<1);
+       pci_write_config32(dev, 0xd0, value);
+       value = pci_read_config32(dev, 0xd4);
+       value |= (1<<1);
+       pci_write_config32(dev, 0xd4, value);
+       setup_ioapic(IO_APIC_ADDR, 0); // Don't rename IO APIC ID.
+
+       i82801ex_enable_serial_irqs(dev);
+
+       i82801ex_pci_dma_cfg(dev);
+
+       i82801ex_enable_lpc(dev);
+
+       /* Clear SATA to non raid */
+       pci_write_config8(dev, 0xae, 0x00);
+
+        get_option(&pwr_on, "power_on_after_fail");
+       byte = pci_read_config8(dev, 0xa4);
+       byte &= 0xfe;
+       if (!pwr_on) {
+               byte |= 1;
+       }
+       pci_write_config8(dev, 0xa4, byte);
+       printk_info("set power %s after power fail\n", pwr_on?"on":"off");
+
+       /* Set up the PIRQ */
+       i82801ex_pirq_init(dev);
+       
+       /* Set the state of the gpio lines */
+       i82801ex_gpio_init(dev);
+
+       /* Initialize the real time clock */
+       rtc_init(0);
+
+       /* Initialize isa dma */
+       isa_dma_init();
+
+       /* Disable IDE (needed when sata is enabled) */
+       pci_write_config8(dev, 0xf2, 0x60);
+       
+       enable_hpet(dev);
+}
+
+static void i82801ex_lpc_read_resources(device_t dev)
+{
+       struct resource *res;
+
+       /* Get the normal PCI resources of this device. */
+       pci_dev_read_resources(dev);
+
+       /* Add the ACPI BAR */
+       res = pci_get_resource(dev, ACPI_BAR);
+
+       /* Add the GPIO BAR */
+       res = pci_get_resource(dev, GPIO_BAR);
+
+       /* Add an extra subtractive resource for both memory and I/O. */
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void i82801ex_lpc_enable_resources(device_t dev)
+{
+       uint8_t acpi_cntl, gpio_cntl;
+
+       /* Enable the normal pci resources */
+       pci_dev_enable_resources(dev);
+
+       /* Enable the ACPI bar */
+       acpi_cntl = pci_read_config8(dev, 0x44);
+       acpi_cntl |= (1 << 4);
+       pci_write_config8(dev, 0x44, acpi_cntl);
+       
+       /* Enable the GPIO bar */
+       gpio_cntl = pci_read_config8(dev, 0x5c);
+       gpio_cntl |= (1 << 4);
+       pci_write_config8(dev, 0x5c, gpio_cntl);
+
+       enable_childrens_resources(dev);
+}
+
+static struct pci_operations lops_pci = {
+       .set_subsystem = 0,
+};
+
+static struct device_operations lpc_ops  = {
+       .read_resources   = i82801ex_lpc_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = i82801ex_lpc_enable_resources,
+       .init             = lpc_init,
+       .scan_bus         = scan_static_bus,
+       .enable           = i82801ex_enable,
+       .ops_pci          = &lops_pci,
+};
+
+static const struct pci_driver lpc_driver __pci_driver = {
+       .ops    = &lpc_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_LPC,
+};
diff --git a/src/southbridge/intel/i82801ex/i82801ex_pci.c b/src/southbridge/intel/i82801ex/i82801ex_pci.c
new file mode 100644 (file)
index 0000000..650628b
--- /dev/null
@@ -0,0 +1,45 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void pci_init(struct device *dev)
+{
+       uint32_t dword;
+       uint16_t word;
+
+       /* Clear system errors */
+       word = pci_read_config16(dev, 0x06);
+       word |= 0xf900; /* Clear possible errors */
+       pci_write_config16(dev, 0x06, word);
+
+#if 0
+       /* System error enable */
+       dword = pci_read_config32(dev, 0x04);
+       dword |= (1<<8); /* SERR# Enable */
+       dword |= (1<<6); /* Parity Error Response */
+       pci_write_config32(dev, 0x04, dword);
+#endif                         
+       
+       word = pci_read_config16(dev, 0x1e);
+       word |= 0xf800; /* Clear possible errors */
+       pci_write_config16(dev, 0x1e, word);
+}
+
+static struct device_operations pci_ops  = {
+       .read_resources   = pci_bus_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_bus_enable_resources,
+       .init             = pci_init,
+       .scan_bus         = pci_scan_bridge,
+       .ops_pci          = 0,
+};
+
+static const struct pci_driver pci_driver __pci_driver = {
+       .ops    = &pci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_PCI,
+};
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_reset.c b/src/southbridge/intel/i82801ex/i82801ex_reset.c
new file mode 100644 (file)
index 0000000..a1d92a7
--- /dev/null
@@ -0,0 +1,7 @@
+#include <arch/io.h>
+
+void i82801ex_hard_reset(void)
+{
+        /* Try rebooting through port 0xcf9 */
+        outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
+}
diff --git a/src/southbridge/intel/i82801ex/i82801ex_sata.c b/src/southbridge/intel/i82801ex/i82801ex_sata.c
new file mode 100644 (file)
index 0000000..98431ed
--- /dev/null
@@ -0,0 +1,63 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void sata_init(struct device *dev)
+{
+
+       uint16_t word;
+
+  printk_debug("SATA init\n");
+       /* SATA configuration */
+       pci_write_config8(dev, 0x04, 0x07);
+       pci_write_config8(dev, 0x09, 0x8f);
+       
+       /* Set timmings */
+       pci_write_config16(dev, 0x40, 0x0a307);
+       pci_write_config16(dev, 0x42, 0x0a307);
+
+       /* Sync DMA */
+       pci_write_config16(dev, 0x48, 0x000f);
+       pci_write_config16(dev, 0x4a, 0x1111);
+
+       /* 66 mhz */
+       pci_write_config16(dev, 0x54, 0xf00f);
+
+       /* Combine ide - sata configuration */
+       pci_write_config8(dev, 0x90, 0x0);
+       
+       /* port 0 & 1 enable */
+       pci_write_config8(dev, 0x92, 0x33);
+       
+       /* initialize SATA  */
+       pci_write_config16(dev, 0xa0, 0x0018);
+       pci_write_config32(dev, 0xa4, 0x00000264);
+       pci_write_config16(dev, 0xa0, 0x0040);
+       pci_write_config32(dev, 0xa4, 0x00220043);
+
+}
+
+static struct device_operations sata_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = sata_init,
+       .scan_bus         = 0,
+       .ops_pci          = 0,
+};
+
+static const struct pci_driver sata_driver __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_SATA,
+};
+
+static const struct pci_driver sata_driver_nr __pci_driver = {
+       .ops    = &sata_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801EB_SATA,
+};
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_smbus.c b/src/southbridge/intel/i82801ex/i82801ex_smbus.c
new file mode 100644 (file)
index 0000000..adfbcb7
--- /dev/null
@@ -0,0 +1,45 @@
+#include <device/device.h>
+#include <device/path.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include <device/smbus.h>
+#include <arch/io.h>
+#include "i82801ex.h"
+#include "i82801ex_smbus.h"
+
+static int lsmbus_read_byte(struct bus *bus, device_t dev, uint8_t address)
+{
+       unsigned device;
+       struct resource *res;
+
+       device = dev->path.i2c.device;
+       res = find_resource(bus->dev, 0x20);
+       
+       return do_smbus_read_byte(res->base, device, address);
+}
+
+static struct smbus_bus_operations lops_smbus_bus = {
+       .read_byte  = lsmbus_read_byte,
+};
+static struct pci_operations lops_pci = {
+       /* The subsystem id follows the ide controller */
+       .set_subsystem = 0,
+};
+static struct device_operations smbus_ops = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = 0,
+       .scan_bus         = scan_static_bus,
+       .enable           = i82801ex_enable,
+       .ops_pci          = &lops_pci,
+       .ops_smbus_bus    = &lops_smbus_bus,
+};
+
+static const struct pci_driver smbus_driver __pci_driver = {
+       .ops    = &smbus_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_SMB,
+};
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_smbus.h b/src/southbridge/intel/i82801ex/i82801ex_smbus.h
new file mode 100644 (file)
index 0000000..861230e
--- /dev/null
@@ -0,0 +1,105 @@
+#include <device/smbus_def.h>
+
+#define SMBHSTSTAT 0x0
+#define SMBHSTCTL  0x2
+#define SMBHSTCMD  0x3
+#define SMBXMITADD 0x4
+#define SMBHSTDAT0 0x5
+#define SMBHSTDAT1 0x6
+#define SMBBLKDAT  0x7
+#define SMBTRNSADD 0x9
+#define SMBSLVDATA 0xa
+#define SMLINK_PIN_CTL 0xe
+#define SMBUS_PIN_CTL  0xf 
+
+#define SMBUS_TIMEOUT (100*1000*10)
+
+
+static void smbus_delay(void)
+{
+       outb(0x80, 0x80);
+}
+
+static int smbus_wait_until_ready(unsigned smbus_io_base)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                       break;
+               byte = inb(smbus_io_base + SMBHSTSTAT);
+       } while(byte & 1);
+       return loops?0:-1;
+}
+
+static int smbus_wait_until_done(unsigned smbus_io_base)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                      break;
+               byte = inb(smbus_io_base + SMBHSTSTAT);
+       } while((byte & 1) || (byte & ~((1<<6)|(1<<0))) == 0);
+       return loops?0:-1;
+}
+
+static int smbus_wait_until_blk_done(unsigned smbus_io_base)
+{
+       unsigned loops = SMBUS_TIMEOUT;
+       unsigned char byte;
+       do {
+               smbus_delay();
+               if (--loops == 0)
+                      break;
+               byte = inb(smbus_io_base + SMBHSTSTAT);
+       } while((byte&(1<<7)) == 0);
+       return loops?0:-1;
+}
+
+static int do_smbus_read_byte(unsigned smbus_io_base, unsigned device, unsigned address)
+{
+       unsigned char global_status_register;
+       unsigned char byte;
+
+       if (smbus_wait_until_ready(smbus_io_base) < 0) {
+               return SMBUS_WAIT_UNTIL_READY_TIMEOUT;
+       }
+       /* setup transaction */
+       /* disable interrupts */
+       outb(inb(smbus_io_base + SMBHSTCTL) & (~1), smbus_io_base + SMBHSTCTL);
+       /* set the device I'm talking too */
+       outb(((device & 0x7f) << 1) | 1, smbus_io_base + SMBXMITADD);
+       /* set the command/address... */
+       outb(address & 0xFF, smbus_io_base + SMBHSTCMD);
+       /* set up for a byte data read */
+       outb((inb(smbus_io_base + SMBHSTCTL) & 0xE3) | (0x2 << 2), smbus_io_base + SMBHSTCTL);
+       /* clear any lingering errors, so the transaction will run */
+       outb(inb(smbus_io_base + SMBHSTSTAT), smbus_io_base + SMBHSTSTAT);
+
+       /* clear the data byte...*/
+       outb(0, smbus_io_base + SMBHSTDAT0);
+
+       /* start the command */
+       outb((inb(smbus_io_base + SMBHSTCTL) | 0x40), smbus_io_base + SMBHSTCTL);
+
+       /* poll for transaction completion */
+       if (smbus_wait_until_done(smbus_io_base) < 0) {
+               return SMBUS_WAIT_UNTIL_DONE_TIMEOUT;
+       }
+
+       global_status_register = inb(smbus_io_base + SMBHSTSTAT);
+
+       /* Ignore the In Use Status... */
+       global_status_register &= ~(3 << 5);
+
+       /* read results of transaction */
+       byte = inb(smbus_io_base + SMBHSTDAT0);
+       if (global_status_register != (1 << 1)) {
+               return SMBUS_ERROR;
+       }
+       return byte;
+}
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_uhci.c b/src/southbridge/intel/i82801ex/i82801ex_uhci.c
new file mode 100644 (file)
index 0000000..177b820
--- /dev/null
@@ -0,0 +1,56 @@
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include "i82801ex.h"
+
+static void uhci_init(struct device *dev)
+{
+       uint32_t cmd;
+
+#if 1
+       printk_debug("UHCI: Setting up controller.. ");
+       cmd = pci_read_config32(dev, PCI_COMMAND);
+       pci_write_config32(dev, PCI_COMMAND, 
+               cmd | PCI_COMMAND_MASTER);
+
+
+       printk_debug("done.\n");
+#endif
+
+}
+
+static struct pci_operations lops_pci = {
+       /* The subsystem id follows the ide controller */
+       .set_subsystem = 0,
+};
+
+static struct device_operations uhci_ops  = {
+       .read_resources   = pci_dev_read_resources,
+       .set_resources    = pci_dev_set_resources,
+       .enable_resources = pci_dev_enable_resources,
+       .init             = uhci_init,
+       .scan_bus         = 0,
+       .enable           = i82801ex_enable,
+       .ops_pci          = &lops_pci,
+};
+
+static const struct pci_driver uhci_driver __pci_driver = {
+       .ops    = &uhci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_USB1,
+};
+
+static const struct pci_driver usb2_driver __pci_driver = {
+       .ops    = &uhci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_USB2,
+};
+
+static const struct pci_driver usb3_driver __pci_driver = {
+       .ops    = &uhci_ops,
+       .vendor = PCI_VENDOR_ID_INTEL,
+       .device = PCI_DEVICE_ID_INTEL_82801ER_USB3,
+};
+
diff --git a/src/southbridge/intel/i82801ex/i82801ex_watchdog.c b/src/southbridge/intel/i82801ex/i82801ex_watchdog.c
new file mode 100644 (file)
index 0000000..c9c09f5
--- /dev/null
@@ -0,0 +1,28 @@
+#include <console/console.h>
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pci.h>
+
+void watchdog_off(void)
+{
+        device_t dev;
+        unsigned long value,base;
+
+       /* turn off the ICH5 watchdog */
+        dev = dev_find_slot(0, PCI_DEVFN(0x1f,0));
+        /* Enable I/O space */
+        value = pci_read_config16(dev, 0x04);
+        value |= (1 << 10);
+        pci_write_config16(dev, 0x04, value);
+        /* Get TCO base */
+        base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
+        /* Disable the watchdog timer */
+        value = inw(base + 0x08);
+        value |= 1 << 11;
+        outw(value, base + 0x08);
+        /* Clear TCO timeout status */
+        outw(0x0008, base + 0x04);
+        outw(0x0002, base + 0x06);
+        printk_debug("Watchdog ICH5 disabled\r\n");
+}
+
diff --git a/src/southbridge/intel/i82801xx/Kconfig b/src/southbridge/intel/i82801xx/Kconfig
deleted file mode 100644 (file)
index f86c65f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-##
-## This file is part of the coreboot project.
-##
-## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
-##
-## 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; either version 2 of the License, or
-## (at your option) any later version.
-##
-## 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 SOUTHBRIDGE_INTEL_I82801XX
-       bool
-
diff --git a/src/southbridge/intel/i82801xx/Makefile.inc b/src/southbridge/intel/i82801xx/Makefile.inc
deleted file mode 100644 (file)
index 875141f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-##
-## This file is part of the coreboot project.
-##
-## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
-##
-## 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; either version 2 of the License, or
-## (at your option) any later version.
-##
-## 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
-##
-
-driver-y += i82801xx.o
-driver-y += i82801xx_ac97.o
-driver-y += i82801xx_ide.o
-driver-y += i82801xx_lpc.o
-driver-y += i82801xx_nic.o
-driver-y += i82801xx_pci.o
-driver-y += i82801xx_sata.o
-# driver-y += i82801xx_smbus.o
-driver-y += i82801xx_usb.o
-driver-y += i82801xx_usb_ehci.o
-
-obj-y += i82801xx_reset.o
-obj-y += i82801xx_watchdog.o
-
-# TODO: What about cmos_failover.c?
-
-# TODO: Fix and enable i82801xx_smbus.o later.
-
diff --git a/src/southbridge/intel/i82801xx/chip.h b/src/southbridge/intel/i82801xx/chip.h
deleted file mode 100644 (file)
index 443df45..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2007 Corey Osgood <corey_osgood@verizon.net>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/*
- * The i82801xx code currently supports:
- *  - 82801AA
- *  - 82801AB
- *  - 82801BA
- *  - 82801CA
- *  - 82801DB
- *  - 82801DBM
- *  - 82801EB
- *  - 82801ER
- *
- * This code should NOT be used for ICH6 and later versions.
- */
-
-#ifndef SOUTHBRIDGE_INTEL_I82801XX_CHIP_H
-#define SOUTHBRIDGE_INTEL_I82801XX_CHIP_H
-
-struct southbridge_intel_i82801xx_config {
-       /**
-        * Interrupt Routing configuration
-        * If bit7 is 1, the interrupt is disabled.
-        */
-       uint8_t pirqa_routing;
-       uint8_t pirqb_routing;
-       uint8_t pirqc_routing;
-       uint8_t pirqd_routing;
-       uint8_t pirqe_routing;
-       uint8_t pirqf_routing;
-       uint8_t pirqg_routing;
-       uint8_t pirqh_routing;
-
-       uint8_t ide0_enable;
-       uint8_t ide1_enable;
-};
-
-extern struct chip_operations southbridge_intel_i82801xx_ops;
-
-#endif
diff --git a/src/southbridge/intel/i82801xx/cmos_failover.c b/src/southbridge/intel/i82801xx/cmos_failover.c
deleted file mode 100644 (file)
index 9307f40..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 "i82801xx.h"
-
-static void check_cmos_failed(void)
-{
-       uint8_t byte;
-       byte = pci_read_config8(PCI_DEV(0, 0x1f, 0), GEN_PMCON_3);
-       if (byte & RTC_FAILED) {
-               //clear bit 1 and bit 2
-               byte = cmos_read(RTC_BOOT_BYTE);
-               byte &= 0x0c;
-               byte |= CONFIG_MAX_REBOOT_CNT << 4;
-               cmos_write(byte, RTC_BOOT_BYTE);
-       }
-}
diff --git a/src/southbridge/intel/i82801xx/i82801xx.c b/src/southbridge/intel/i82801xx/i82801xx.c
deleted file mode 100644 (file)
index 385b122..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Digital Design Corporation
- * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
- * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include "i82801xx.h"
-
-void i82801xx_enable(device_t dev)
-{
-       unsigned int index = 0;
-       uint16_t cur_disable_mask, new_disable_mask;
-
-       /* All 82801xx devices should be on bus 0. */
-       unsigned int devfn = PCI_DEVFN(0x1f, 0);        // LPC
-       device_t lpc_dev = dev_find_slot(0, devfn);     // 0
-       if (!lpc_dev)
-               return;
-
-       /* We're going to assume, perhaps incorrectly, that if a function
-        * exists it can be disabled. Workarounds for ICH variants that don't
-        * follow this should be done by checking the device ID.
-        */
-       if (PCI_SLOT(dev->path.pci.devfn) == 31) {
-               index = PCI_FUNC(dev->path.pci.devfn);
-       } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
-               index = 8 + PCI_FUNC(dev->path.pci.devfn);
-       }
-
-       /* Function 0 is a bit of an exception. */
-       if (index == 0) {
-               index = 14;
-       }
-
-       cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
-       new_disable_mask = cur_disable_mask & ~(1 << index); /* Enable it. */
-       if (!dev->enabled) {
-               new_disable_mask |= (1 << index); /* Disable it, if desired. */
-       }
-       if (new_disable_mask != cur_disable_mask) {
-               pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
-       }
-}
-
-struct chip_operations southbridge_intel_i82801xx_ops = {
-       CHIP_NAME("Intel 82801 Series Southbridge")
-       .enable_dev = i82801xx_enable,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx.h b/src/southbridge/intel/i82801xx/i82801xx.h
deleted file mode 100644 (file)
index d90cc32..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 SOUTHBRIDGE_INTEL_I82801XX_I82801XX_H
-#define SOUTHBRIDGE_INTEL_I82801XX_I82801XX_H
-
-#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
-#include "chip.h"
-extern void i82801xx_enable(device_t dev);
-#endif
-
-#define PCI_DMA_CFG            0x90
-#define SERIRQ_CNTL            0x64
-#define GEN_CNTL               0xd0
-#define GEN_STS                        0xd4
-#define RTC_CONF               0xd8
-#define GEN_PMCON_3            0xa4
-
-#define PMBASE                 0x40
-#define PMBASE_ADDR            0x0400 /* ACPI Base Address Register */
-#define ACPI_CNTL              0x44
-#define BIOS_CNTL              0x4E
-#define GPIO_BASE_ICH0_5       0x58 /* LPC GPIO Base Addr. Reg. (ICH0-ICH5) */
-#define GPIO_BASE_ICH6_9       0x48 /* LPC GPIO Base Address Register (ICH6-ICH9) */
-#define GPIO_CNTL_ICH0_5       0x5C /* LPC GPIO Control Register (ICH0-ICH5) */
-#define GPIO_CNTL_ICH6_9       0x4C /* LPC GPIO Control Register (ICH6-ICH9) */
-
-#define PIRQA_ROUT             0x60
-#define PIRQB_ROUT             0x61
-#define PIRQC_ROUT             0x62
-#define PIRQD_ROUT             0x63
-#define PIRQE_ROUT             0x68
-#define PIRQF_ROUT             0x69
-#define PIRQG_ROUT             0x6A
-#define PIRQH_ROUT             0x6B
-
-#define FUNC_DIS               0xF2
-
-#define COM_DEC                        0xE0 /* LPC I/F Communication Port Decode Ranges (ICH0-ICH5) */
-#define LPC_IO_DEC             0x80 /* IO Decode Ranges Register (ICH6-ICH9) */
-#define LPC_EN_ICH0_5          0xE6 /* LPC IF Enables Register (ICH0-ICH5) */
-#define LPC_EN_ICH6_9          0x82 /* LPC IF Enables Register (ICH6-ICH9) */
-
-#define SBUS_NUM               0x19
-#define SUB_BUS_NUM            0x1A
-#define SMLT                   0x1B
-#define IOBASE                 0x1C
-#define IOLIM                  0x1D
-#define MEMBASE                        0x20
-#define MEMLIM                 0x22
-#define CNF                    0x50
-#define MTT                    0x70
-#define PCI_MAST_STS           0x82
-
-#define TCOBASE                        0x60 /* TCO Base Address Register */
-#define TCO1_CNT               0x08 /* TCO1 Control Register */
-
-/* GEN_PMCON_3 bits */
-#define RTC_BATTERY_DEAD       (1 << 2)
-#define RTC_POWER_FAILED       (1 << 1)
-#define SLEEP_AFTER_POWER_FAIL (1 << 0)
-
-/* PCI Configuration Space (D31:F1) */
-#define IDE_TIM_PRI            0x40    /* IDE timings, primary */
-#define IDE_TIM_SEC            0x42    /* IDE timings, secondary */
-
-/* IDE_TIM bits */
-#define IDE_DECODE_ENABLE      (1 << 15)
-
-/* PCI Configuration Space (D31:F3) */
-#define SMB_BASE               0x20
-#define HOSTC                  0x40
-
-/* HOSTC bits */
-#define I2C_EN                 (1 << 2)
-#define SMB_SMI_EN             (1 << 1)
-#define HST_EN                 (1 << 0)
-
-/* SMBus I/O bits.
- * TODO: Does it matter where we put the SMBus IO base, as long as we keep
- * consistent and don't interfere with anything else?
- */
-/* #define SMBUS_IO_BASE 0x1000 */
-#define SMBUS_IO_BASE          0x0f00
-
-#define SMBHSTSTAT             0x0
-#define SMBHSTCTL              0x2
-#define SMBHSTCMD              0x3
-#define SMBXMITADD             0x4
-#define SMBHSTDAT0             0x5
-#define SMBHSTDAT1             0x6
-#define SMBBLKDAT              0x7
-#define SMBTRNSADD             0x9
-#define SMBSLVDATA             0xa
-#define SMLINK_PIN_CTL         0xe
-#define SMBUS_PIN_CTL          0xf
-
-#define SMBUS_TIMEOUT          (10 * 1000 * 100)
-
-/* HPET, if present */
-#define HPET_ADDR              0xfed0000
-
-#endif                         /* SOUTHBRIDGE_INTEL_I82801XX_I82801XX_H */
diff --git a/src/southbridge/intel/i82801xx/i82801xx_ac97.c b/src/southbridge/intel/i82801xx/i82801xx_ac97.c
deleted file mode 100644 (file)
index ace04ff..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/* This code should work for all ICH* southbridges with AC97 audio/modem. */
-
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801xx.h"
-
-static struct device_operations ac97_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = 0,
-       .scan_bus               = 0,
-       .enable                 = i82801xx_enable,
-};
-
-/* 82801AA (ICH) */
-static const struct pci_driver i82801aa_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801aa_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AA_AC97_MODEM,
-};
-
-/* 82801AB (ICH0) */
-static const struct pci_driver i82801ab_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801ab_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AB_AC97_MODEM,
-};
-
-/* 82801BA/BAM (ICH2/ICH2-M) */
-static const struct pci_driver i82801ba_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801ba_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_AC97_MODEM,
-};
-
-/* 82801CA/CAM (ICH3-S/ICH3-M) */
-static const struct pci_driver i82801ca_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801ca_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_AC97_MODEM,
-};
-
-/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
-static const struct pci_driver i82801db_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801db_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_AC97_MODEM,
-};
-
-/* 82801EB/ER (ICH5/ICH5R) */
-static const struct pci_driver i82801eb_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801eb_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_AC97_MODEM,
-};
-
-/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
-static const struct pci_driver i82801fb_ac97_audio __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_AUDIO,
-};
-
-static const struct pci_driver i82801fb_ac97_modem __pci_driver = {
-       .ops    = &ac97_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_AC97_MODEM,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_early_lpc.c b/src/southbridge/intel/i82801xx/i82801xx_early_lpc.c
deleted file mode 100644 (file)
index 3ae91d7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2008 Joseph Smith <joe@settoplinux.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 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
- *
- */
-
-static void i82801xx_halt_tco_timer(void)
-{
-       device_t dev;
-       uint16_t halt_tco_timer;
-
-       /* Set the LPC device statically. */
-       dev = PCI_DEV(0x0, 0x1f, 0x0);
-
-       /* Temporarily set ACPI base address (I/O space). */
-       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
-
-       /* Temporarily enable ACPI I/O. */
-       pci_write_config8(dev, ACPI_CNTL, 0x10);
-
-       /* Halt the TCO timer, preventing SMI and automatic reboot */
-       outw(inw(PMBASE_ADDR + TCOBASE + TCO1_CNT) | (1 << 11), PMBASE_ADDR + TCOBASE + TCO1_CNT);
-
-       /* Disable ACPI I/O. */
-       pci_write_config8(dev, ACPI_CNTL, 0x00);
-}
diff --git a/src/southbridge/intel/i82801xx/i82801xx_early_smbus.c b/src/southbridge/intel/i82801xx/i82801xx_early_smbus.c
deleted file mode 100644 (file)
index d1bd051..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <device/pci_ids.h>
-#include "i82801xx.h"
-#include "i82801xx_smbus.h"
-
-static void enable_smbus(void)
-{
-       device_t dev;
-       uint16_t device_id;
-
-       /* Set the SMBus device statically. */
-       dev = PCI_DEV(0x0, 0x1f, 0x3);
-
-       /* Check to make sure we've got the right device. */
-       device_id = pci_read_config16(dev, 0x2);
-
-       /* Clear bits 7-4 (the only bits that vary between models). */
-       device_id &= 0xff0f;
-
-       if (device_id != 0x2403) {
-               die("Device not found, Corey probably screwed up!");
-       }
-
-       /* Set SMBus I/O base. */
-       pci_write_config32(dev, SMB_BASE,
-                          SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
-
-       /* Set SMBus enable. */
-       pci_write_config8(dev, HOSTC, HST_EN);
-
-       /* Set SMBus I/O space enable. */
-       pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
-
-       /* Disable interrupt generation. */
-       outb(0, SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* Clear any lingering errors, so transactions can run. */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       print_debug("SMBus controller enabled\r\n");
-}
-
-static inline int smbus_read_byte(unsigned device, unsigned address)
-{
-       return do_smbus_read_byte(device, address);
-}
-
-static void smbus_write_byte(unsigned device, unsigned address,
-                            unsigned char val)
-{
-       print_err("Unimplemented smbus_write_byte() called\r\n");
-       return;
-}
-
-static inline int smbus_write_block(unsigned device, unsigned length,
-                                   unsigned cmd, unsigned data1,
-                                   unsigned data2)
-{
-       return do_smbus_write_block(device, length, cmd, data1, data2);
-}
diff --git a/src/southbridge/intel/i82801xx/i82801xx_ide.c b/src/southbridge/intel/i82801xx/i82801xx_ide.c
deleted file mode 100644 (file)
index 4173cc6..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- * Copyright (C) 2005 Digital Design Corporation
- * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801xx.h"
-
-typedef struct southbridge_intel_i82801xx_config config_t;
-
-static void ide_init(struct device *dev)
-{
-       /* Get the chip configuration */
-       config_t *config = dev->chip_info; 
-
-       /* TODO: Needs to be tested for compatibility with ICH5(R). */
-       /* Enable IDE devices so the Linux IDE driver will work. */
-       uint16_t ideTimingConfig;
-
-       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
-       ideTimingConfig &= ~IDE_DECODE_ENABLE;
-       if (!config || config->ide0_enable) {
-               /* Enable primary IDE interface. */
-               ideTimingConfig |= IDE_DECODE_ENABLE;
-               printk_debug("IDE0: Primary IDE interface is enabled\n");
-       } else {
-               printk_info("IDE0: Primary IDE interface is disabled\n");
-       }
-       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
-
-       ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
-       ideTimingConfig &= ~IDE_DECODE_ENABLE;
-       if (!config || config->ide1_enable) {
-               /* Enable secondary IDE interface. */
-               ideTimingConfig |= IDE_DECODE_ENABLE;
-               printk_debug("IDE1: Secondary IDE interface is enabled\n");
-       } else {
-               printk_info("IDE1: Secondary IDE interface is disabled\n");
-       }
-       pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
-}
-
-static struct device_operations ide_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = ide_init,
-       .scan_bus               = 0,
-       .enable                 = i82801xx_enable,
-};
-
-/* 82801AA */
-static const struct pci_driver i82801aa_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2411,
-};
-
-/* 82801AB */
-static const struct pci_driver i82801ab_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2421,
-};
-
-/* 82801BA */
-static const struct pci_driver i82801ba_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x244b,
-};
-
-/* 82801CA */
-static const struct pci_driver i82801ca_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x248b,
-};
-
-/* 82801DB */
-static const struct pci_driver i82801db_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24cb,
-};
-
-/* 82801DBM */
-static const struct pci_driver i82801dbm_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24ca,
-};
-
-/* 82801EB & 82801ER */
-static const struct pci_driver i82801ex_ide __pci_driver = {
-       .ops    = &ide_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24db,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_lpc.c b/src/southbridge/intel/i82801xx/i82801xx_lpc.c
deleted file mode 100644 (file)
index f7fae37..0000000
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2003 Linux Networx
- * Copyright (C) 2003 SuSE Linux AG
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/* From 82801DBM, needs to be fixed to support everything the 82801ER does. */
-
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <pc80/mc146818rtc.h>
-#include <pc80/isa-dma.h>
-#include <arch/io.h>
-#include "i82801xx.h"
-
-#define GPIO_BASE_ADDR 0x00000500 /* GPIO Base Address Register */
-
-#define NMI_OFF 0
-
-typedef struct southbridge_intel_i82801xx_config config_t;
-
-/* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control
- * 0x00 - 0000 = Reserved
- * 0x01 - 0001 = Reserved
- * 0x02 - 0010 = Reserved
- * 0x03 - 0011 = IRQ3
- * 0x04 - 0100 = IRQ4
- * 0x05 - 0101 = IRQ5
- * 0x06 - 0110 = IRQ6
- * 0x07 - 0111 = IRQ7
- * 0x08 - 1000 = Reserved
- * 0x09 - 1001 = IRQ9
- * 0x0A - 1010 = IRQ10
- * 0x0B - 1011 = IRQ11
- * 0x0C - 1100 = IRQ12
- * 0x0D - 1101 = Reserved
- * 0x0E - 1110 = IRQ14
- * 0x0F - 1111 = IRQ15
- * PIRQ[n]_ROUT[7] - PIRQ Routing Control
- * 0x80 - The PIRQ is not routed.
- */
-
-#define PIRQA 0x03
-#define PIRQB 0x04
-#define PIRQC 0x05
-#define PIRQD 0x06
-#define PIRQE 0x07
-#define PIRQF 0x09
-#define PIRQG 0x0A
-#define PIRQH 0x0B
-
-/* 
- * Use 0x0ef8 for a bitmap to cover all these IRQ's. 
- * Use the defined IRQ values above or set mainboard
- * specific IRQ values in your mainboards Config.lb.
-*/
-
-void i82801xx_enable_apic(struct device *dev)
-{
-       uint32_t reg32;
-       volatile uint32_t *ioapic_index = (volatile uint32_t *)0xfec00000;
-       volatile uint32_t *ioapic_data = (volatile uint32_t *)0xfec00010;
-
-       /* Set ACPI base address (I/O space). */
-       pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
-
-       /* Enable ACPI I/O and power management. */
-       pci_write_config8(dev, ACPI_CNTL, 0x10);
-
-       reg32 = pci_read_config32(dev, GEN_CNTL);
-       reg32 |= (3 << 7);      /* Enable IOAPIC */
-       reg32 |= (1 << 13);     /* Coprocessor error enable */
-       reg32 |= (1 << 1);      /* Delayed transaction enable */
-       reg32 |= (1 << 2);      /* DMA collection buffer enable */
-       pci_write_config32(dev, GEN_CNTL, reg32);
-       printk_debug("IOAPIC Southbridge enabled %x\n", reg32);
-
-       *ioapic_index = 0;
-       *ioapic_data = (1 << 25);
-
-       *ioapic_index = 0;
-       reg32 = *ioapic_data;
-       printk_debug("Southbridge APIC ID = %x\n", reg32);
-       if (reg32 != (1 << 25))
-               die("APIC Error\n");
-
-       /* TODO: From i82801ca, needed/useful on other ICH? */
-       *ioapic_index = 3; /* Select Boot Configuration register. */
-       *ioapic_data = 1; /* Use Processor System Bus to deliver interrupts. */
-}
-
-void i82801xx_enable_serial_irqs(struct device *dev)
-{
-       /* Set packet length and toggle silent mode bit. */
-       pci_write_config8(dev, SERIRQ_CNTL,
-                         (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0));
-       pci_write_config8(dev, SERIRQ_CNTL,
-                         (1 << 7) | (0 << 6) | ((21 - 17) << 2) | (0 << 0));
-       /* TODO: Explain/#define the real meaning of these magic numbers. */
-}
-
-static void i82801xx_pirq_init(device_t dev, uint16_t ich_model)
-{
-       /* Get the chip configuration */
-       config_t *config = dev->chip_info;
-
-       if (config->pirqa_routing) {
-               pci_write_config8(dev, PIRQA_ROUT, config->pirqa_routing);
-       } else {
-               pci_write_config8(dev, PIRQA_ROUT, PIRQA);
-       }
-
-       if (config->pirqb_routing) {
-               pci_write_config8(dev, PIRQB_ROUT, config->pirqb_routing);
-       } else {
-               pci_write_config8(dev, PIRQB_ROUT, PIRQB);
-       }
-
-       if (config->pirqc_routing) {
-               pci_write_config8(dev, PIRQC_ROUT, config->pirqc_routing);
-       } else {
-               pci_write_config8(dev, PIRQC_ROUT, PIRQC);
-       }
-
-       if (config->pirqd_routing) {
-               pci_write_config8(dev, PIRQD_ROUT, config->pirqd_routing);
-       } else {
-               pci_write_config8(dev, PIRQD_ROUT, PIRQD);
-       }
-
-       /* Route PIRQE - PIRQH (for ICH2-ICH9). */
-       if (ich_model >= 0x2440) {
-
-               if (config->pirqe_routing) {
-                       pci_write_config8(dev, PIRQE_ROUT, config->pirqe_routing);
-               } else {
-                       pci_write_config8(dev, PIRQE_ROUT, PIRQE);
-               }
-
-               if (config->pirqf_routing) {
-                       pci_write_config8(dev, PIRQF_ROUT, config->pirqf_routing);
-               } else {
-                       pci_write_config8(dev, PIRQF_ROUT, PIRQF);
-               }
-
-               if (config->pirqg_routing) {
-                       pci_write_config8(dev, PIRQG_ROUT, config->pirqg_routing);
-               } else {
-                       pci_write_config8(dev, PIRQG_ROUT, PIRQG);
-               }
-
-               if (config->pirqh_routing) {
-                       pci_write_config8(dev, PIRQH_ROUT, config->pirqh_routing);
-               } else {
-                       pci_write_config8(dev, PIRQH_ROUT, PIRQH);
-               }
-       }
-}
-
-static void i82801xx_power_options(device_t dev)
-{
-       uint8_t byte;
-       int pwr_on = -1;
-       int nmi_option;
-
-       /* power after power fail */
-       /* FIXME this doesn't work! */
-       /* Which state do we want to goto after g3 (power restored)?
-        * 0 == S0 Full On
-        * 1 == S5 Soft Off
-        */
-       pci_write_config8(dev, GEN_PMCON_3, pwr_on ? 0 : 1);
-       printk_info("Set power %s if power fails\n", pwr_on ? "on" : "off");
-
-       /* Set up NMI on errors. */
-       byte = inb(0x61);
-       byte &= ~(1 << 3);      /* IOCHK# NMI Enable */
-       byte &= ~(1 << 2);      /* PCI SERR# Enable */
-       outb(byte, 0x61);
-       byte = inb(0x70);
-
-       nmi_option = NMI_OFF;
-       get_option(&nmi_option, "nmi");
-       if (nmi_option) {
-               byte &= ~(1 << 7);      /* Set NMI. */
-               outb(byte, 0x70);
-       }
-}
-
-static void gpio_init(device_t dev, uint16_t ich_model)
-{
-       /* Set the value for GPIO base address register and enable GPIO.
-        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
-        */
-       if (ich_model <= 0x24D0) {
-               pci_write_config32(dev, GPIO_BASE_ICH0_5, (GPIO_BASE_ADDR | 1));
-               pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
-       } else if (ich_model >= 0x2640) {
-               pci_write_config32(dev, GPIO_BASE_ICH6_9, (GPIO_BASE_ADDR | 1));
-               pci_write_config8(dev, GPIO_CNTL_ICH6_9, 0x10);
-       }
-}
-
-void i82801xx_rtc_init(struct device *dev)
-{
-       uint8_t reg8;
-       uint32_t reg32;
-       int rtc_failed;
-
-       reg8 = pci_read_config8(dev, GEN_PMCON_3);
-       rtc_failed = reg8 & RTC_BATTERY_DEAD;
-       if (rtc_failed) {
-               reg8 &= ~(1 << 1);      /* Preserve the power fail state. */
-               pci_write_config8(dev, GEN_PMCON_3, reg8);
-       }
-       reg32 = pci_read_config32(dev, GEN_STS);
-       rtc_failed |= reg32 & (1 << 2);
-       rtc_init(rtc_failed);
-
-       /* Enable access to the upper 128 byte bank of CMOS RAM. */
-       pci_write_config8(dev, RTC_CONF, 0x04);
-}
-
-void i82801xx_lpc_route_dma(struct device *dev, uint8_t mask)
-{
-       uint16_t reg16;
-       int i;
-
-       reg16 = pci_read_config16(dev, PCI_DMA_CFG);
-       reg16 &= 0x300;
-       for (i = 0; i < 8; i++) {
-               if (i == 4)
-                       continue;
-               reg16 |= ((mask & (1 << i)) ? 3 : 1) << (i * 2);
-       }
-       pci_write_config16(dev, PCI_DMA_CFG, reg16);
-}
-
-static void i82801xx_lpc_decode_en(device_t dev, uint16_t ich_model)
-{
-       /* Decode 0x3F8-0x3FF (COM1) for COMA port, 0x2F8-0x2FF (COM2) for COMB.
-        * LPT decode defaults to 0x378-0x37F and 0x778-0x77F.
-        * Floppy decode defaults to 0x3F0-0x3F5, 0x3F7.
-        * We also need to set the value for LPC I/F Enables Register.
-        * Note: ICH-ICH5 registers differ from ICH6-ICH9.
-        */
-       if (ich_model <= 0x24D0) {
-               pci_write_config8(dev, COM_DEC, 0x10);
-               pci_write_config16(dev, LPC_EN_ICH0_5, 0x300F);
-       } else if (ich_model >= 0x2640) {
-               pci_write_config8(dev, LPC_IO_DEC, 0x10);
-               pci_write_config16(dev, LPC_EN_ICH6_9, 0x300F);
-       }
-}
-
-static void enable_hpet(struct device *dev)
-{
-#ifdef HPET_PRESENT
-       uint32_t reg32;
-       uint32_t code = (0 & 0x3);
-
-       reg32 = pci_read_config32(dev, GEN_CNTL);
-       reg32 |= (1 << 17);     /* Enable HPET. */
-       /*
-        * Bits [16:15] Memory Address Range
-        * 00           FED0_0000h - FED0_03FFh
-        * 01           FED0_1000h - FED0_13FFh
-        * 10           FED0_2000h - FED0_23FFh
-        * 11           FED0_3000h - FED0_33FFh
-        */
-       reg32 &= ~(3 << 15);    /* Clear it */
-       reg32 |= (code << 15);
-       /* TODO: reg32 is never written to anywhere? */
-       printk_debug("Enabling HPET @0x%x\n", HPET_ADDR | (code << 12));
-#endif
-}
-
-static void lpc_init(struct device *dev)
-{
-       uint16_t ich_model = pci_read_config16(dev, PCI_DEVICE_ID);
-
-       /* Set the value for PCI command register. */
-       pci_write_config16(dev, PCI_COMMAND, 0x000f);
-
-       /* IO APIC initialization. */
-       i82801xx_enable_apic(dev);
-
-       i82801xx_enable_serial_irqs(dev);
-
-       /* Setup the PIRQ. */
-       i82801xx_pirq_init(dev, ich_model);
-
-       /* Setup power options. */
-       i82801xx_power_options(dev);
-
-       /* Set the state of the GPIO lines. */
-       gpio_init(dev, ich_model);
-
-       /* Initialize the real time clock. */
-       i82801xx_rtc_init(dev);
-
-       /* Route DMA. */
-       i82801xx_lpc_route_dma(dev, 0xff);
-
-       /* Initialize ISA DMA. */
-       isa_dma_init();
-
-       /* Setup decode ports and LPC I/F enables. */
-       i82801xx_lpc_decode_en(dev, ich_model);
-
-       /* Initialize the High Precision Event Timers, if present. */
-       enable_hpet(dev);
-}
-
-static void i82801xx_lpc_read_resources(device_t dev)
-{
-       struct resource *res;
-
-       /* Get the normal PCI resources of this device. */
-       pci_dev_read_resources(dev);
-
-       /* Add an extra subtractive resource for both memory and I/O. */
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
-       res->base = 0;
-       res->size = 0x1000;
-       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
-       res->base = 0xff800000;
-       res->size = 0x00800000; /* 8 MB for flash */
-       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
-                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-
-       res = new_resource(dev, 3); /* IOAPIC */
-       res->base = 0xfec00000;
-       res->size = 0x00001000;
-       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-}
-
-static void i82801xx_lpc_enable_resources(device_t dev)
-{
-       pci_dev_enable_resources(dev);
-       enable_childrens_resources(dev);
-}
-
-static struct device_operations lpc_ops = {
-       .read_resources         = i82801xx_lpc_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = i82801xx_lpc_enable_resources,
-       .init                   = lpc_init,
-       .scan_bus               = scan_static_bus,
-       .enable                 = i82801xx_enable,
-};
-
-static const struct pci_driver i82801aa_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2410,
-};
-
-static const struct pci_driver i82801ab_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2420,
-};
-
-static const struct pci_driver i82801ba_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2440,
-};
-
-static const struct pci_driver i82801ca_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2480,
-};
-
-static const struct pci_driver i82801db_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24c0,
-};
-
-static const struct pci_driver i82801dbm_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24cc,
-};
-
-/* 82801EB and 82801ER */
-static const struct pci_driver i82801ex_lpc __pci_driver = {
-       .ops    = &lpc_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24d0,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_nic.c b/src/southbridge/intel/i82801xx/i82801xx_nic.c
deleted file mode 100644 (file)
index 3728d28..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/* This code should work for all ICH* southbridges with a NIC. */
-
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-
-static struct device_operations nic_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = 0,
-       .scan_bus               = 0,
-};
-
-/* Note: There's no NIC on 82801AA/AB (ICH/ICH0). */
-
-/* 82801BA/BAM/CA/CAM (ICH2/ICH2-M/ICH3-S/ICH3-M) */
-static const struct pci_driver i82801ba_nic __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_LAN,
-};
-
-/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
-static const struct pci_driver i82801db_nic __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_LAN,
-};
-
-/* 82801EB/ER (ICH5/ICH5R) */
-static const struct pci_driver i82801eb_nic __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_LAN,
-};
-
-/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
-static const struct pci_driver i82801fb_nic __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_LAN,
-};
-
-/* 82801E (C-ICH) */
-static const struct pci_driver i82801e_nic1 __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801E_LAN1,
-};
-
-static const struct pci_driver i82801e_nic2 __pci_driver = {
-       .ops    = &nic_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801E_LAN2,
-};
-
diff --git a/src/southbridge/intel/i82801xx/i82801xx_pci.c b/src/southbridge/intel/i82801xx/i82801xx_pci.c
deleted file mode 100644 (file)
index 1f01e5d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-
-static void pci_init(struct device *dev)
-{
-       uint16_t reg16;
-
-       /* Clear system errors */
-       reg16 = pci_read_config16(dev, 0x06);
-       reg16 |= 0xf900;        /* Clear possible errors */
-       pci_write_config16(dev, 0x06, reg16);
-
-       reg16 = pci_read_config16(dev, 0x1e);
-       reg16 |= 0xf800;        /* Clear possible errors */
-       pci_write_config16(dev, 0x1e, reg16);
-}
-
-static struct device_operations pci_ops = {
-       .read_resources         = pci_bus_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_bus_enable_resources,
-       .init                   = pci_init,
-       .scan_bus               = pci_scan_bridge,
-};
-
-static const struct pci_driver i82801aa_pci __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2418,
-};
-
-static const struct pci_driver i82801ab_pci __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2428,
-};
-
-/* 82801BA, 82801CA, 82801DB, 82801EB, and 82801ER */
-static const struct pci_driver i82801misc_pci __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x244e,
-};
-
-static const struct pci_driver i82801dbm_pci __pci_driver = {
-       .ops    = &pci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x2448,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_reset.c b/src/southbridge/intel/i82801xx/i82801xx_reset.c
deleted file mode 100644 (file)
index 239a727..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2002 Eric Biederman <ebiederm@xmission.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <arch/io.h>
-
-void hard_reset(void)
-{
-       /* Try rebooting through port 0xcf9. */
-       outb((1 << 2) | (1 << 1), 0xcf9);
-}
diff --git a/src/southbridge/intel/i82801xx/i82801xx_sata.c b/src/southbridge/intel/i82801xx/i82801xx_sata.c
deleted file mode 100644 (file)
index de8b3b0..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801xx.h"
-
-/* TODO: Set dynamically, if the user only wants one SATA channel or none
- * at all.
- */
-static void sata_init(struct device *dev)
-{
-       /* SATA configuration */
-       pci_write_config8(dev, 0x04, 0x07);
-       pci_write_config8(dev, 0x09, 0x8f);
-
-       /* Set timmings */
-       pci_write_config16(dev, 0x40, 0x0a307);
-       pci_write_config16(dev, 0x42, 0x0a307);
-
-       /* Sync DMA */
-       pci_write_config16(dev, 0x48, 0x000f);
-       pci_write_config16(dev, 0x4a, 0x1111);
-
-       /* 66 MHz */
-       pci_write_config16(dev, 0x54, 0xf00f);
-
-       /* Combine IDE - SATA configuration */
-       pci_write_config8(dev, 0x90, 0x0);
-
-       /* Port 0 & 1 enable */
-       pci_write_config8(dev, 0x92, 0x33);
-
-       /* Initialize SATA. */
-       pci_write_config16(dev, 0xa0, 0x0018);
-       pci_write_config32(dev, 0xa4, 0x00000264);
-       pci_write_config16(dev, 0xa0, 0x0040);
-       pci_write_config32(dev, 0xa4, 0x00220043);
-}
-
-static struct device_operations sata_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = sata_init,
-       .scan_bus               = 0,
-       .enable                 = i82801xx_enable,
-};
-
-/* 82801EB */
-static const struct pci_driver i82801eb_sata_driver __pci_driver = {
-       .ops    = &sata_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24d1,
-};
-
-/* 82801ER */
-static const struct pci_driver i82801er_sata_driver __pci_driver = {
-       .ops    = &sata_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24df,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_smbus.c b/src/southbridge/intel/i82801xx/i82801xx_smbus.c
deleted file mode 100644 (file)
index 1608650..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/* TODO: Check datasheets if this will work for all ICH* southbridges. */
-
-#include <stdint.h>
-#include <smbus.h>
-#include <pci.h>
-#include <arch/io.h>
-#include "i82801xx.h"
-#include "i82801_smbus.h"
-
-static int smbus_read_byte(struct bus *bus, device_t dev, u8 address)
-{
-       unsigned device;        /* TODO: u16? */
-       struct resource *res;
-
-       device = dev->path.i2c.device;
-       res = find_resource(bus->dev, 0x20);
-
-       return do_smbus_read_byte(res->base, device, address);
-}
-
-static struct smbus_bus_operations lops_smbus_bus = {
-       .read_byte      = smbus_read_byte,
-};
-
-static const struct device_operations smbus_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = 0,
-       .scan_bus               = scan_static_bus,
-       .enable                 = i82801er_enable,
-       .ops_smbus_bus          = &lops_smbus_bus,
-};
-
-/* 82801AA (ICH) */
-static const struct pci_driver i82801aa_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AA_SMB,
-};
-
-/* 82801AB (ICH0) */
-static const struct pci_driver i82801ab_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AB_SMB,
-};
-
-/* 82801BA/BAM (ICH2/ICH2-M) */
-static const struct pci_driver i82801ba_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_SMB,
-};
-
-/* 82801CA/CAM (ICH3-S/ICH3-M) */
-static const struct pci_driver i82801ca_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_SMB,
-};
-
-/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
-static const struct pci_driver i82801db_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_SMB,
-};
-
-/* 82801EB/ER (ICH5/ICH5R) */
-static const struct pci_driver i82801eb_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_SMB,
-};
-
-/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
-static const struct pci_driver i82801fb_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_SMB,
-};
-
-/* 82801E (C-ICH) */
-static const struct pci_driver i82801e_smb __pci_driver = {
-       .ops    = &smbus_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801E_SMB,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_smbus.h b/src/southbridge/intel/i82801xx/i82801xx_smbus.h
deleted file mode 100644 (file)
index 7a78508..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Yinghai Lu <yinghailu@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <device/smbus_def.h>
-
-static void smbus_delay(void)
-{
-       inb(0x80);
-}
-
-static int smbus_wait_until_ready(void)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                       break;
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       } while (byte & 1);
-       return loops ? 0 : -1;
-}
-
-static int smbus_wait_until_done(void)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                       break;
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       } while ((byte & 1) || (byte & ~((1 << 6) | (1 << 0))) == 0);
-       return loops ? 0 : -1;
-}
-
-static int smbus_wait_until_blk_done(void)
-{
-       unsigned loops = SMBUS_TIMEOUT;
-       unsigned char byte;
-       do {
-               smbus_delay();
-               if (--loops == 0)
-                       break;
-               byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       } while ((byte & (1 << 7)) == 0);
-       return loops ? 0 : -1;
-}
-
-static int do_smbus_read_byte(unsigned device, unsigned address)
-{
-       unsigned char global_status_register;
-       unsigned char byte;
-
-       if (smbus_wait_until_ready() < 0) {
-               return SMBUS_WAIT_UNTIL_READY_TIMEOUT;
-       }
-       /* Setup transaction */
-       /* Disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
-       /* Set the device I'm talking too */
-       outb(((device & 0x7f) << 1) | 1, SMBUS_IO_BASE + SMBXMITADD);
-       /* Set the command/address... */
-       outb(address & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
-       /* Set up for a byte data read */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x2 << 2),
-            (SMBUS_IO_BASE + SMBHSTCTL));
-       /* Clear any lingering errors, so the transaction will run */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* Clear the data byte... */
-       outb(0, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* Start the command */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) | 0x40),
-            SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* Poll for transaction completion */
-       if (smbus_wait_until_done() < 0) {
-               return SMBUS_WAIT_UNTIL_DONE_TIMEOUT;
-       }
-
-       global_status_register = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-
-       /* Ignore the "In Use" status... */
-       global_status_register &= ~(3 << 5);
-
-       /* Read results of transaction */
-       byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
-       if (global_status_register != (1 << 1)) {
-               return SMBUS_ERROR;
-       }
-       return byte;
-}
-
-/* This function is neither used nor tested by me (Corey Osgood), the author 
-(Yinghai) probably tested/used it on i82801er */
-static int do_smbus_write_block(unsigned device, unsigned length, unsigned cmd,
-                               unsigned data1, unsigned data2)
-{
-#warning "do_smbus_write_block is commented out"
-       print_err("Untested smbus_write_block called\r\n");
-#if 0
-       unsigned char global_control_register;
-       unsigned char global_status_register;
-       unsigned char byte;
-       unsigned char stat;
-       int i;
-
-       /* Clear the PM timeout flags, SECOND_TO_STS */
-       outw(inw(0x0400 + 0x66), 0x0400 + 0x66);
-
-       if (smbus_wait_until_ready(SMBUS_IO_BASE) < 0) {
-               return -2;
-       }
-
-       /* Setup transaction */
-       /* Obtain ownership */
-       outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
-       for (stat = 0; (stat & 0x40) == 0;) {
-               stat = inb(SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-       /* Clear the done bit */
-       outb(0x80, SMBUS_IO_BASE + SMBHSTSTAT);
-       /* Disable interrupts */
-       outb(inb(SMBUS_IO_BASE + SMBHSTCTL) & (~1), SMBUS_IO_BASE + SMBHSTCTL);
-
-       /* Set the device I'm talking too */
-       outb(((device & 0x7f) << 1), SMBUS_IO_BASE + SMBXMITADD);
-
-       /* Set the command address */
-       outb(cmd & 0xff, SMBUS_IO_BASE + SMBHSTCMD);
-
-       /* Set the block length */
-       outb(length & 0xff, SMBUS_IO_BASE + SMBHSTDAT0);
-
-       /* Try sending out the first byte of data here */
-       byte = (data1 >> (0)) & 0x0ff;
-       outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
-       /* Issue a block write command */
-       outb((inb(SMBUS_IO_BASE + SMBHSTCTL) & 0xe3) | (0x5 << 2) | 0x40,
-            SMBUS_IO_BASE + SMBHSTCTL);
-
-       for (i = 0; i < length; i++) {
-
-               /* Poll for transaction completion */
-               if (smbus_wait_until_blk_done(SMBUS_IO_BASE) < 0) {
-                       return -3;
-               }
-
-               /* Load the next byte */
-               if (i > 3)
-                       byte = (data2 >> (i % 4)) & 0x0ff;
-               else
-                       byte = (data1 >> (i)) & 0x0ff;
-               outb(byte, SMBUS_IO_BASE + SMBBLKDAT);
-
-               /* Clear the done bit */
-               outb(inb(SMBUS_IO_BASE + SMBHSTSTAT),
-                    SMBUS_IO_BASE + SMBHSTSTAT);
-       }
-
-       print_debug("SMBUS Block complete\r\n");
-       return 0;
-#endif
-}
diff --git a/src/southbridge/intel/i82801xx/i82801xx_usb.c b/src/southbridge/intel/i82801xx/i82801xx_usb.c
deleted file mode 100644 (file)
index 74bbbee..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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
- */
-
-/* This code should work for all ICH* southbridges with USB. */
-
-#include <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801xx.h"
-
-static void usb_init(struct device *dev)
-{
-       /* TODO: Any init needed? Some ports have it, others don't. */
-}
-
-static struct device_operations usb_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = usb_init,
-       .scan_bus               = 0,
-       .enable                 = i82801xx_enable,
-};
-
-/* 82801AA (ICH) */
-static const struct pci_driver i82801aa_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AA_USB,
-};
-
-/* 82801AB (ICH0) */
-static const struct pci_driver i82801ab_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801AB_USB,
-};
-
-/* 82801BA/BAM (ICH2/ICH2-M) */
-static const struct pci_driver i82801ba_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_USB1,
-};
-
-static const struct pci_driver i82801ba_usb2 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801BA_USB2,
-};
-
-/* 82801CA/CAM (ICH3-S/ICH3-M) */
-static const struct pci_driver i82801ca_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_USB1,
-};
-
-static const struct pci_driver i82801ca_usb2 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_USB2,
-};
-
-static const struct pci_driver i82801ca_usb3 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801CA_USB3,
-};
-
-/* 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) */
-static const struct pci_driver i82801db_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_USB1,
-};
-
-static const struct pci_driver i82801db_usb2 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_USB2,
-};
-
-static const struct pci_driver i82801db_usb3 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801DB_USB3,
-};
-
-/* 82801EB/ER (ICH5/ICH5R) */
-static const struct pci_driver i82801eb_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_USB1,
-};
-
-static const struct pci_driver i82801eb_usb2 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_USB2,
-};
-
-static const struct pci_driver i82801eb_usb3 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_USB3,
-};
-
-static const struct pci_driver i82801eb_usb4 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801EB_USB4,
-};
-
-/* 82801FB/FR/FW/FRW/FBM (ICH6/ICH6R/ICH6W/ICH6RW/ICH6-M) */
-static const struct pci_driver i82801fb_usb1 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_USB1,
-};
-
-static const struct pci_driver i82801fb_usb2 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_USB2,
-};
-
-static const struct pci_driver i82801fb_usb3 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_USB3,
-};
-
-static const struct pci_driver i82801fb_usb4 __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801FB_USB4,
-};
-
-/* 82801E (C-ICH) */
-static const struct pci_driver i82801e_usb __pci_driver = {
-       .ops    = &usb_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = PCI_DEVICE_ID_INTEL_82801E_USB,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_usb_ehci.c b/src/southbridge/intel/i82801xx/i82801xx_usb_ehci.c
deleted file mode 100644 (file)
index 032f198..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2005 Tyan Computer
- * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include "i82801xx.h"
-
-static void usb_ehci_init(struct device *dev)
-{
-       /* TODO: Is any special init really needed? */
-       uint32_t cmd;
-
-       printk_debug("EHCI: Setting up controller.. ");
-       cmd = pci_read_config32(dev, PCI_COMMAND);
-       pci_write_config32(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
-
-       printk_debug("done.\n");
-}
-
-static void usb_ehci_set_subsystem(device_t dev, unsigned vendor,
-                                  unsigned device)
-{
-       uint8_t access_cntl;
-
-       access_cntl = pci_read_config8(dev, 0x80);
-
-       /* Enable writes to protected registers. */
-       pci_write_config8(dev, 0x80, access_cntl | 1);
-
-       /* Write the subsystem vendor and device ID. */
-       pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-
-       /* Restore protection. */
-       pci_write_config8(dev, 0x80, access_cntl);
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem  = &usb_ehci_set_subsystem,
-};
-
-static struct device_operations usb_ehci_ops = {
-       .read_resources         = pci_dev_read_resources,
-       .set_resources          = pci_dev_set_resources,
-       .enable_resources       = pci_dev_enable_resources,
-       .init                   = usb_ehci_init,
-       .scan_bus               = 0,
-       .enable                 = i82801xx_enable,
-       .ops_pci                = &lops_pci,
-};
-
-/* 82801DB and 82801DBM */
-static const struct pci_driver i82801db_usb_ehci __pci_driver = {
-       .ops    = &usb_ehci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24cd,
-};
-
-/* 82801EB and 82801ER */
-static const struct pci_driver i82801ex_usb_ehci __pci_driver = {
-       .ops    = &usb_ehci_ops,
-       .vendor = PCI_VENDOR_ID_INTEL,
-       .device = 0x24dd,
-};
diff --git a/src/southbridge/intel/i82801xx/i82801xx_watchdog.c b/src/southbridge/intel/i82801xx/i82801xx_watchdog.c
deleted file mode 100644 (file)
index aea10e1..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2006 John Dufresne <jon.dufresne@gmail.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <console/console.h>
-#include <arch/io.h>
-#include <device/device.h>
-#include <device/pci.h>
-
-/* TODO: I'm fairly sure the same functionality is provided elsewhere. */
-
-void watchdog_off(void)
-{
-       device_t dev;
-       unsigned long value, base;
-
-       /* Turn off the ICH5 watchdog. */
-       dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0));
-
-       /* Enable I/O space. */
-       value = pci_read_config16(dev, 0x04);
-       value |= (1 << 10);
-       pci_write_config16(dev, 0x04, value);
-
-       /* Get TCO base. */
-       base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
-
-       /* Disable the watchdog timer. */
-       value = inw(base + 0x08);
-       value |= 1 << 11;
-       outw(value, base + 0x08);
-
-       /* Clear TCO timeout status. */
-       outw(0x0008, base + 0x04);
-       outw(0x0002, base + 0x06);
-
-       printk_debug("ICH Watchdog disabled\r\n");
-}