Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 LiPPERT Embedded Computers GmbH |
| 5 | * |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 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. |
| 10 | * |
| 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. |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Uwe Hermann | 86c9b88 | 2008-11-19 13:42:14 +0000 | [diff] [blame] | 17 | /* Based on mainboard.c from AMD's DB800 mainboard. */ |
| 18 | |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 19 | #include <stdlib.h> |
| 20 | #include <stdint.h> |
| 21 | #include <console/console.h> |
| 22 | #include <device/device.h> |
| 23 | #include <arch/io.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 26 | |
Jens Rottmann | b9ee31d | 2010-08-31 19:19:16 +0000 | [diff] [blame] | 27 | /* Bit1 switches Com1 to RS485, bit2 same for Com2, bit5 turns off the Live LED. */ |
| 28 | #if CONFIG_ONBOARD_UARTS_RS485 |
| 29 | #define SIO_GP1X_CONFIG 0x26 |
| 30 | #else |
| 31 | #define SIO_GP1X_CONFIG 0x20 |
| 32 | #endif |
| 33 | |
Uwe Hermann | 86c9b88 | 2008-11-19 13:42:14 +0000 | [diff] [blame] | 34 | static const u16 ec_init_table[] = { /* hi=data, lo=index */ |
| 35 | 0x1900, /* Enable monitoring */ |
| 36 | 0x0351, /* TMPIN1,2 diode mode, TMPIN3 off */ |
| 37 | 0x805C, /* Unlock zero adjust */ |
| 38 | 0x7056, 0x3C57, /* Zero adjust TMPIN1,2 */ |
| 39 | 0x005C, /* Lock zero adjust */ |
| 40 | 0xD014 /* Also set FAN_CTL polarity to Active High */ |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static void init(struct device *dev) |
| 44 | { |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 45 | unsigned int gpio_base, i; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 46 | printk(BIOS_DEBUG, "LiPPERT RoadRunner-LX ENTER %s\n", __func__); |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 47 | |
Uwe Hermann | 86c9b88 | 2008-11-19 13:42:14 +0000 | [diff] [blame] | 48 | /* Init CS5536 GPIOs. */ |
| 49 | gpio_base = pci_read_config32(dev_find_device(PCI_VENDOR_ID_AMD, |
| 50 | PCI_DEVICE_ID_AMD_CS5536_ISA, 0), PCI_BASE_ADDRESS_1) - 1; |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 51 | |
Uwe Hermann | 86c9b88 | 2008-11-19 13:42:14 +0000 | [diff] [blame] | 52 | outl(0x00000040, gpio_base + 0x00); // GPIO6 value 1 - LAN_PD# |
| 53 | outl(0x00000040, gpio_base + 0x04); // GPIO6 output 1 - LAN_PD# |
| 54 | outl(0x00000400, gpio_base + 0x34); // GPIO10 in aux1 1 - THRM_ALRM# |
| 55 | outl(0x00000400, gpio_base + 0x20); // GPIO10 input 1 - THRM_ALRM# |
| 56 | outl(0x08000000, gpio_base + 0x98); // GPIO27 pull up 0 - PM-LED |
| 57 | |
| 58 | /* Init Environment Controller. */ |
| 59 | for (i = 0; i < ARRAY_SIZE(ec_init_table); i++) { |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 60 | u16 val = ec_init_table[i]; |
Uwe Hermann | 86c9b88 | 2008-11-19 13:42:14 +0000 | [diff] [blame] | 61 | outb((u8)val, 0x0295); |
| 62 | outb(val >> 8, 0x0296); |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 63 | } |
| 64 | |
Jens Rottmann | b9ee31d | 2010-08-31 19:19:16 +0000 | [diff] [blame] | 65 | /* bit5 = Live LED, bit2 = RS485_EN2, bit1 = RS485_EN1 */ |
| 66 | outb(SIO_GP1X_CONFIG, 0x1220); /* Simple-I/O GP17-10 */ |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 67 | printk(BIOS_DEBUG, "LiPPERT RoadRunner-LX EXIT %s\n", __func__); |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 70 | static void mainboard_enable(struct device *dev) |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 71 | { |
| 72 | dev->ops->init = init; |
| 73 | } |
| 74 | |
Carl-Daniel Hailfinger | 7ad11e8 | 2009-02-18 20:41:57 +0000 | [diff] [blame] | 75 | struct chip_operations mainboard_ops = { |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 76 | .enable_dev = mainboard_enable, |
Jens Rottmann | f31ca16 | 2008-11-19 12:19:09 +0000 | [diff] [blame] | 77 | }; |