[LinuxBIOS] [PATCH] Add initial serial output for Via vt82c686

Adam Talbot talbotx at comcast.net
Tue Mar 13 01:47:46 CET 2007


Web site update? Should I update the site?

Corey Osgood wrote:
> Here's the updated version of this patch, which from what I can see
> works perfectly fine, every boot. The description, once again:
>
> This patch is just for initial serial output for the Via vt82c686(a/b)
> southbridge, no more and no less. SMBus and the rest of the SuperI/O
> functions are yet to be written. I've confirmed that this works on
> Tyan S2507 (vt686b), and it should also work fine on vt686a. This is
> based rather loosely on Uwe's code for the SMSC FDC37M60x.
>
> Signed-off-by: Corey Osgood <corey_osgood at verizon.net>
> ------------------------------------------------------------------------
>
> Index: src/southbridge/via/vt686/Config.lb
> ===================================================================
> --- src/southbridge/via/vt686/Config.lb	(revision 0)
> +++ src/southbridge/via/vt686/Config.lb	(revision 0)
> @@ -0,0 +1,23 @@
> +##
> +## This file is part of the LinuxBIOS project.
> +##
> +## Copyright (C) 2007 Corey Osgood <corey_osgood at 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
> +##
> +
> +config chip.h
> +object superio.o
> +
> Index: src/southbridge/via/vt686/vt686.h
> ===================================================================
> --- src/southbridge/via/vt686/vt686.h	(revision 0)
> +++ src/southbridge/via/vt686/vt686.h	(revision 0)
> @@ -0,0 +1,50 @@
> +/*
> + * This file is part of the LinuxBIOS project.
> + *
> + * Copyright (C) 2007 Corey Osgood <corey_osgood at 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
> + */
> +
> +/* Datasheets:
> + * Name: VT82C686A "Super South" South Bridge
> + * Link: http://www.datasheets.org.uk/datasheet.php?article=3510260
> + * Name: VT82C686B "Super South" South Bridge
> + * Link: http://www.datasheet4u.com/html/V/T/8/VT82C686B_VIA.pdf.html */
> +
> +/* SuperI/0 Configuration Registers */
> +/* Any registers not listed here are for floppy control or are reserved */
> +#define VT686_CFG_PORT	0x3F0
> +
> +#define	VT686_FS	0xE2 /* Function Select */
> +#define	VT686_PP_BA	0xE6 /* Parallel Port Base Addr. (def = 378-F) */
> +#define	VT686_COM1_BA	0xE7 /* Serial Port 1 Base Addr. (def =	3F8-F) */
> +#define	VT686_COM2_BA	0xE8 /* Serial Port 2 Base Addr. (def =	2F8-F) */
> +#define	VT686_COM_CFG	0xEE /* Serial Port Configuration */
> +#define	VT686_POWER	0xEF /* Power Down Control */
> +#define	VT686_PPCTRL	0xF0 /* Parallel Port Control */
> +#define	VT686_SPCTRL	0xF1 /* Serial Port Control */
> +#define	VT686_GP_IO	0xFC /* General Purpose I/O */
> +
> +/* For reference, used PCI IDs and their names in pci_ids.h */
> +/*
> +PCI_VENDOR_ID_VIA		0x1106
> +PCI_DEVICE_ID_VIA_82C686	0x0686 //Function 0, PCI Config
> +PCI_DEVICE_ID_VIA_82C586_1	0x0571 //Function 1, IDE Controller
> +PCI_DEVICE_ID_VIA_82C586_2	0x3038 //Functions 2 & 3, USB Ports 0-1 & 2-3 Config
> +PCI_DEVICE_ID_VIA_82C586_3	0x3040 //Possible 2nd USB Controller? Not used on my setup/datasheets
> +PCI_DEVICE_ID_VIA_82C686_4	0x3057 //Function 4, Power Management
> +PCI_DEVICE_ID_VIA_82C686_5	0x3058 //Function 5 AC'97 Codec
> +PCI_DEVICE_ID_VIA_82C686_6	0x3068 //Function 6 MC'97 Codec */
> Index: src/southbridge/via/vt686/vt686_early_serial.c
> ===================================================================
> --- src/southbridge/via/vt686/vt686_early_serial.c	(revision 0)
> +++ src/southbridge/via/vt686/vt686_early_serial.c	(revision 0)
> @@ -0,0 +1,83 @@
> +/*
> + * This file is part of the LinuxBIOS project.
> + *
> + * Copyright (C) 2006 Uwe Hermann <uwe at hermann-uwe.de>
> + * Copyright (C) 2007 Corey Osgood <corey_osgood at 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
> + */
> +
> +/* This has been ported to the Via vt82c686(a/b) from SMSC FDC37M60x by Corey Osgood */
> +/* See vt686.h for more information */
> +
> +#include <arch/romcc_io.h>
> +#include <device/pci_ids.h>
> +#include "vt686.h"
> +
> +#define SIO_BASE			VT686_CFG_PORT
> +#define SIO_INDEX			SIO_BASE
> +#define SIO_DATA			SIO_BASE+1
> +
> +static void vt686_sio_write(uint8_t index, uint8_t value)
> +{
> +	/* 2) Configure the chip */
> +	/*   a) Write index to port 0x3F0 */
> +	outb(index, SIO_BASE);
> +	/*   b) Read / write data from / to port 0x3F1 */
> +	outb(value, SIO_DATA);
> +}
> +
> +/* Enable the peripheral devices on the VT686 Super I/O chip. */
> +static void vt686_enable_serial( void )
> +{
> +	/* (1) Enter the configuration state. ( Set PCI Function 0 Rx85[1] = 1 ) */
> +	device_t dev;
> +	/* First, find the southbridge. Trip the POST card if we don't (does die() do this?)*/
> +	dev = pci_locate_device( PCI_ID( PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686 ), 0 );
> +	if ( dev == PCI_DEV_INVALID ) {
> +		outb( 0xff, 0x80 );
> +		die( "Southbridge not found\r\n" );
> +	}
> +	pci_write_config8( dev, 0x85, 0x1f ); //Enable the SuperI/O, SI/O Config, and disable everything else
> +	
> +	/* 2) Configure the chip */
> +	vt686_sio_write( VT686_POWER, 0x00 ); //Make sure all devs are powered on. FIXME: only power on used devices
> +	vt686_sio_write( VT686_COM_CFG, 0x00 ); //Set up COMs for normal (non-IR) operation
> +	vt686_sio_write( VT686_FS, 0x07 ); //Disable Floppy, Enable COM1, Disable COM2 and Parallel Port
> +	/* Index E2 (aka VT686_FS) Super-I/O Function Select 
> +	7-5 Reserved (Reads 0)
> +	4 Floppy Controller Enable
> +		0 Disable (default)
> +		1 Enable
> +	3 Serial Port 2 
> +		1 Enable
> +		0 Disable (default)
> +
> +	2 Serial Port 1
> +		0 Disable (default)
> +		1 Enable
> +
> +	1-0 Parallel Port Mode / Enable
> +		00 Unidirectional mode
> +		01 ECP
> +		10 EPP
> +		11 Disable (default) */
> +
> +	vt686_sio_write( VT686_COM1_BA, 0xfe ); //Set COM1 Base Addr to doc default (3F8)
> +	vt686_sio_write( VT686_COM_CFG, 0x40 ); //Enable High-Speed mode for COM1
> +	
> +	/* 3) Exit Configuration mode */
> +	pci_write_config8( dev, 0x85, 0x0d ); //Now set SI/O Config off, enable USB 2/3	
> +}
> Index: src/southbridge/via/vt686/chip.h
> ===================================================================
> --- src/southbridge/via/vt686/chip.h	(revision 0)
> +++ src/southbridge/via/vt686/chip.h	(revision 0)
> @@ -0,0 +1,35 @@
> +/*
> + * This file is part of the LinuxBIOS project.
> + *
> + * Copyright (C) 2007 Corey Osgood <corey_osgood at 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
> + */
> +
> +#ifndef _SUPERIO_VIA_VT686
> +#define _SUPERIO_VIA_VT686
> +
> +#include <device/device.h>
> +#include <pc80/keyboard.h>
> +#include <uart8250.h>
> +
> +extern struct chip_operations superio_via_vt686_ops;
> +
> +struct superio_via_vt686_config {
> +	struct uart8250 com1, com2;
> +	struct pc_keyboard keyboard;
> +};
> +
> +#endif /* _SUPERIO_VIA_VT686 */
>   





More information about the coreboot mailing list