2006-07-24 06:25:47 +02:00
|
|
|
/*
|
2008-01-18 11:35:56 +01:00
|
|
|
* This file is part of the coreboot project.
|
2007-05-29 12:37:52 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
|
2010-11-27 10:40:16 +01:00
|
|
|
* Copyright (C) 2010 Keith Hui <buurin@gmail.com>
|
|
|
|
* Copyright (C) 2010 Idwer Vollering <vidwer@gmail.com>
|
|
|
|
* Copyright (C) 2010 Tobias Diedrich <ranma+coreboot@gmail.com>
|
2007-05-29 12:37:52 +02:00
|
|
|
*
|
|
|
|
* 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
|
Remove address from GPLv2 headers
As per discussion with lawyers[tm], it's not a good idea to
shorten the license header too much - not for legal reasons
but because there are tools that look for them, and giving
them a standard pattern simplifies things.
However, we got confirmation that we don't have to update
every file ever added to coreboot whenever the FSF gets a
new lease, but can drop the address instead.
util/kconfig is excluded because that's imported code that
we may want to synchronize every now and then.
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *MA[, ]*02110-1301[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 59 Temple Place[-, ]*Suite 330, Boston, MA *02111-1307[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.:Foundation, Inc.:" {} +
$ find * -type f
-a \! -name \*.patch \
-a \! -name \*_shipped \
-a \! -name LICENSE_GPL \
-a \! -name LGPL.txt \
-a \! -name COPYING \
-a \! -name DISCLAIMER \
-exec sed -i "/Foundation, Inc./ N;s:Foundation, Inc.* USA\.* *:Foundation, Inc. :;s:Foundation, Inc. $:Foundation, Inc.:" {} +
Change-Id: Icc968a5a5f3a5df8d32b940f9cdb35350654bef9
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/9233
Tested-by: build bot (Jenkins)
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
2015-03-26 15:17:45 +01:00
|
|
|
* Foundation, Inc.
|
2007-05-29 12:37:52 +02:00
|
|
|
*/
|
2006-07-24 06:25:47 +02:00
|
|
|
|
2010-11-27 10:40:16 +01:00
|
|
|
#include <arch/io.h>
|
|
|
|
#include <console/console.h>
|
2007-11-30 03:08:26 +01:00
|
|
|
#include <stdint.h>
|
2006-07-24 06:25:47 +02:00
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
|
|
|
#include <device/pci_ids.h>
|
|
|
|
#include <device/smbus.h>
|
2006-08-04 09:50:59 +02:00
|
|
|
#include "i82371eb.h"
|
2010-12-08 06:42:47 +01:00
|
|
|
#include "smbus.h"
|
2006-07-24 06:25:47 +02:00
|
|
|
|
2010-11-27 10:40:16 +01:00
|
|
|
static void pwrmgt_enable(struct device *dev)
|
|
|
|
{
|
|
|
|
struct southbridge_intel_i82371eb_config *sb = dev->chip_info;
|
|
|
|
u32 reg, gpo = sb->gpo;
|
|
|
|
|
|
|
|
/* Sets the base address of power management ports. */
|
|
|
|
pci_write_config16(dev, PMBA, DEFAULT_PMBASE | 1);
|
|
|
|
|
|
|
|
/* Set Power Management IO Space Enable bit */
|
|
|
|
u8 val = pci_read_config8(dev, PMREGMISC);
|
|
|
|
pci_write_config8(dev, PMREGMISC, val | 1);
|
|
|
|
|
|
|
|
/* set global control:
|
|
|
|
* bit25 (lid_pol): 1=invert lid polarity
|
|
|
|
* bit24 (sm_freeze): 1=freeze idle and standby timers
|
|
|
|
* bit16 (end of smi): 0=disable smi assertion (cleared by hw)
|
|
|
|
* bits8-15,26: global standby timer inital count 127 * 4minutes
|
|
|
|
* bit2 (thrm_pol): 1=active low THRM#
|
|
|
|
* bit0 (smi_en): 1=disable smi generation upon smi event
|
|
|
|
*/
|
|
|
|
reg = (sb->lid_polarity<<25)|
|
|
|
|
(1<<24)|
|
|
|
|
(0xff<<8)|
|
|
|
|
(sb->thrm_polarity<<2);
|
|
|
|
outl(reg, DEFAULT_PMBASE + GLBCTL);
|
|
|
|
|
|
|
|
/* set processor control:
|
|
|
|
* bit12 (stpclk_en): 1=enable stopping of host clk on lvl3
|
|
|
|
* bit11 (sleep_en): 1=enable slp# assertion on lvl3
|
|
|
|
* bit9 (cc_en): 1=enable clk control with lvl2 and lvl3 regs
|
|
|
|
*/
|
|
|
|
outl(0, DEFAULT_PMBASE + PCNTRL);
|
|
|
|
|
|
|
|
/* disable smi event enables */
|
|
|
|
outw(0, DEFAULT_PMBASE + GLBEN);
|
|
|
|
outl(0, DEFAULT_PMBASE + DEVCTL);
|
|
|
|
|
|
|
|
/* set default gpo value.
|
|
|
|
* power-on default is 0x7fffbfffh */
|
|
|
|
if (gpo) {
|
|
|
|
/* only 8bit access allowed */
|
|
|
|
outb( gpo & 0xff, DEFAULT_PMBASE + GPO0);
|
|
|
|
outb((gpo >> 8) & 0xff, DEFAULT_PMBASE + GPO1);
|
|
|
|
outb((gpo >> 16) & 0xff, DEFAULT_PMBASE + GPO2);
|
|
|
|
outb((gpo >> 24) & 0xff, DEFAULT_PMBASE + GPO3);
|
|
|
|
} else {
|
|
|
|
printk(BIOS_SPEW,
|
|
|
|
"%s: gpo default missing in devicetree.cb!\n", __func__);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear status events. */
|
|
|
|
outw(0xffff, DEFAULT_PMBASE + PMSTS);
|
|
|
|
outw(0xffff, DEFAULT_PMBASE + GPSTS);
|
|
|
|
outw(0xffff, DEFAULT_PMBASE + GLBSTS);
|
|
|
|
outl(0xffffffff, DEFAULT_PMBASE + DEVSTS);
|
|
|
|
|
2010-12-13 22:39:46 +01:00
|
|
|
/* set PMCNTRL default */
|
2010-11-27 10:40:16 +01:00
|
|
|
outw(SUS_TYP_S0|SCI_EN, DEFAULT_PMBASE + PMCNTRL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void pwrmgt_read_resources(struct device *dev)
|
|
|
|
{
|
|
|
|
struct resource *res;
|
|
|
|
|
|
|
|
pci_dev_read_resources(dev);
|
|
|
|
|
|
|
|
res = new_resource(dev, 1);
|
|
|
|
res->base = DEFAULT_PMBASE;
|
|
|
|
res->size = 0x0040;
|
|
|
|
res->limit = 0xffff;
|
|
|
|
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED |
|
|
|
|
IORESOURCE_RESERVE;
|
|
|
|
|
|
|
|
res = new_resource(dev, 2);
|
|
|
|
res->base = SMBUS_IO_BASE;
|
|
|
|
res->size = 0x0010;
|
|
|
|
res->limit = 0xffff;
|
|
|
|
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED |
|
|
|
|
IORESOURCE_RESERVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-30 03:08:26 +01:00
|
|
|
static const struct smbus_bus_operations lops_smbus_bus = {
|
2006-07-24 06:25:47 +02:00
|
|
|
};
|
|
|
|
|
2007-11-30 03:08:26 +01:00
|
|
|
static const struct device_operations smbus_ops = {
|
2010-11-27 10:40:16 +01:00
|
|
|
.read_resources = pwrmgt_read_resources,
|
2007-05-29 12:37:52 +02:00
|
|
|
.set_resources = pci_dev_set_resources,
|
|
|
|
.enable_resources = pci_dev_enable_resources,
|
|
|
|
.init = 0,
|
|
|
|
.scan_bus = scan_static_bus,
|
2010-11-27 10:40:16 +01:00
|
|
|
.enable = pwrmgt_enable,
|
2007-06-03 18:57:27 +02:00
|
|
|
.ops_pci = 0, /* No subsystem IDs on 82371EB! */
|
2007-05-29 12:37:52 +02:00
|
|
|
.ops_smbus_bus = &lops_smbus_bus,
|
2006-07-24 06:25:47 +02:00
|
|
|
};
|
|
|
|
|
2007-11-30 03:08:26 +01:00
|
|
|
/* Note: There's no SMBus on 82371FB/SB/MX and 82437MX. */
|
|
|
|
|
|
|
|
/* Intel 82371AB/EB/MB */
|
2007-10-24 11:08:58 +02:00
|
|
|
static const struct pci_driver smbus_driver __pci_driver = {
|
2007-05-29 12:37:52 +02:00
|
|
|
.ops = &smbus_ops,
|
|
|
|
.vendor = PCI_VENDOR_ID_INTEL,
|
2007-11-29 02:44:43 +01:00
|
|
|
.device = PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI,
|
2006-07-24 06:25:47 +02:00
|
|
|
};
|