2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
5 * Copyright (C) 2010 Tobias Diedrich <ranma+coreboot@tdiedrich.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
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 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
26 #include "southbridge/via/vt8237r/vt8237r.h"
29 u32 vt8237_ide_80pin_detect(struct device *dev)
36 lpc_dev = dev_find_device(PCI_VENDOR_ID_VIA,
37 PCI_DEVICE_ID_VIA_VT8237R_LPC, 0);
41 acpi_io_base = pci_read_config16(lpc_dev, 0x88) & ~1;
45 /* select function GPIO29 for pin AB9 */
46 pci_write_config8(lpc_dev, 0xe5, pci_read_config8(lpc_dev, 0xe5) | 0x08);
48 gpio_in = inl(acpi_io_base + 0x48);
49 /* bit 29 for primary port, clear if unconnected or 80-pin cable */
50 res = gpio_in & (1<<29) ? 0 : VT8237R_IDE0_80PIN_CABLE;
51 /* bit 8 for secondary port, clear if unconnected or 80-pin cable */
52 res |= gpio_in & (1<<8) ? 0 : VT8237R_IDE1_80PIN_CABLE;
54 printk(BIOS_INFO, "Cable on %s PATA port: %d pin\n", "primary",
55 res & VT8237R_IDE0_80PIN_CABLE ? 80 : 40);
56 printk(BIOS_INFO, "Cable on %s PATA port: %d pin\n", "secondary",
57 res & VT8237R_IDE1_80PIN_CABLE ? 80 : 40);
62 struct chip_operations mainboard_ops = {
63 CHIP_NAME("ASUS K8V-X Mainboard")