2 * This file is part of the coreboot project.
4 * Copyright (C) 2010 LiPPERT Embedded Computers GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 /* Based on mainboard.c from the SpaceRunner-LX mainboard. */
25 #include <console/console.h>
26 #include <device/device.h>
28 #include <device/pci.h>
29 #include <device/pci_ids.h>
32 /* Bit0 turns off the Live LED, bit1 switches Com1 to RS485, bit2 same for Com2. */
33 #if CONFIG_ONBOARD_UARTS_RS485
34 #define SIO_GP1X_CONFIG 0x07
36 #define SIO_GP1X_CONFIG 0x01
39 /* Bit0 enables COM3's transceiver, bit1 disables the RS485 receiver (e.g. for IR). */
40 #define SIO_GP2X_CONFIG 0x00
42 static const u16 ec_init_table[] = { /* hi=data, lo=index */
43 0x1900, /* Enable monitoring */
44 0x3050, /* VIN4,5 enabled */
45 0x0351, /* TMPIN1,2 diode mode, TMPIN3 off */
46 0x805C, /* Unlock zero adjust */
47 0x7056, 0x3C57, /* Zero adjust TMPIN1,2 */
48 0x005C, /* Lock zero adjust */
49 0xD014 /* Also set FAN_CTL polarity to Active High */
52 static void init(struct device *dev)
54 unsigned int gpio_base, i;
55 printk(BIOS_DEBUG, "LiPPERT LiteRunner-LX ENTER %s\n", __func__);
57 /* Init CS5536 GPIOs */
58 gpio_base = pci_read_config32(dev_find_device(PCI_VENDOR_ID_AMD,
59 PCI_DEVICE_ID_AMD_CS5536_ISA, 0), PCI_BASE_ADDRESS_1) - 1;
61 outl(0x00000040, gpio_base + 0x00); // GPIO6 value 1 - LAN_PD#
62 outl(0x00000040, gpio_base + 0x04); // GPIO6 output 1 - LAN_PD#
63 outl(0x04000000, gpio_base + 0x18); // GPIO10 pull up 0 - THRM_ALRM#
64 outl(0x00000400, gpio_base + 0x34); // GPIO10 in aux1 1 - THRM_ALRM#
65 outl(0x00000400, gpio_base + 0x20); // GPIO10 input 1 - THRM_ALRM#
66 outl(0x00000800, gpio_base + 0x94); // GPIO27 out aux2 1 - 32kHz
67 outl(0x00000800, gpio_base + 0x84); // GPIO27 output 1 - 32kHz
68 outl(0x08000000, gpio_base + 0x98); // GPIO27 pull up 0 - 32kHz
70 /* Init Environment Controller. */
71 for (i = 0; i < ARRAY_SIZE(ec_init_table); i++) {
72 u16 val = ec_init_table[i];
73 outb((u8)val, 0x0295);
74 outb(val >> 8, 0x0296);
77 /* bit2 = RS485_EN2, bit1 = RS485_EN1, bit0 = Live LED */
78 outb(SIO_GP1X_CONFIG, 0x1220); /* Simple-I/O GP17-10 */
79 /* bit1 = COM3_RX_EN, bit0 = COM3_TX_EN */
80 outb(SIO_GP2X_CONFIG, 0x1221); /* Simple-I/O GP27-20 */
82 printk(BIOS_DEBUG, "LiPPERT LiteRunner-LX EXIT %s\n", __func__);
85 static void enable_dev(struct device *dev)
87 dev->ops->init = init;
90 struct chip_operations mainboard_ops = {
91 CHIP_NAME("LiPPERT LiteRunner-LX Mainboard")
92 .enable_dev = enable_dev,