mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
This superio is needed for the kontron.
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/coreboot-v3@997 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
8debd4a7ea
commit
adc163d08f
5 changed files with 270 additions and 0 deletions
30
superio/winbond/w83627thg/Makefile
Normal file
30
superio/winbond/w83627thg/Makefile
Normal file
|
@ -0,0 +1,30 @@
|
|||
##
|
||||
## This file is part of the coreboot project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
|
||||
##
|
||||
## 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
|
||||
##
|
||||
|
||||
ifeq ($(CONFIG_SUPERIO_WINBOND_W83627THG),y)
|
||||
|
||||
STAGE0_CHIPSET_SRC += $(src)/superio/winbond/w83627thg/stage1.c
|
||||
STAGE0_CHIPSET_SRC += $(src)/device/pnp_raw.c
|
||||
|
||||
# Always add to variables, as there could be more than one Super I/O.
|
||||
STAGE2_CHIPSET_SRC += $(src)/superio/winbond/w83627thg/superio.c
|
||||
|
||||
endif
|
44
superio/winbond/w83627thg/dts
Normal file
44
superio/winbond/w83627thg/dts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2007 Ronald G. Minnich <rminnich@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
{
|
||||
device_operations = "w83627thg_ops";
|
||||
/* To override any of these, put the over-ride in mainboard dts. */
|
||||
|
||||
/* COM1 */
|
||||
com1dev = "2";
|
||||
com1enable = "0";
|
||||
com1io = "0x3f8";
|
||||
com1irq = "4";
|
||||
|
||||
/* COM2 */
|
||||
com2dev = "3";
|
||||
com2enable = "0";
|
||||
com2io = "0x2f8";
|
||||
com2irq = "3";
|
||||
|
||||
/* Keyboard */
|
||||
kbdev = "5";
|
||||
kbenable = "0";
|
||||
kbio = "0x60";
|
||||
kbio2 = "0x62";
|
||||
kbirq = "1";
|
||||
kbirq2 = "12";
|
||||
};
|
45
superio/winbond/w83627thg/stage1.c
Normal file
45
superio/winbond/w83627thg/stage1.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2000 AG Electronics Ltd.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <io.h>
|
||||
#include <device/pnp.h>
|
||||
#include "w83627thg.h"
|
||||
|
||||
static inline void pnp_enter_ext_func_mode(device_t dev)
|
||||
{
|
||||
unsigned int port = dev >> 8;
|
||||
outb(0x87, port);
|
||||
outb(0x87, port);
|
||||
}
|
||||
|
||||
static void pnp_exit_ext_func_mode(device_t dev)
|
||||
{
|
||||
unsigned int port = dev >> 8;
|
||||
outb(0xaa, port);
|
||||
}
|
||||
|
||||
static void w83627thg_enable_serial(device_t dev, unsigned int iobase)
|
||||
{
|
||||
pnp_enter_ext_func_mode(dev);
|
||||
pnp_set_logical_device(dev);
|
||||
pnp_set_enable(dev, 0);
|
||||
pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
|
||||
pnp_set_enable(dev, 1);
|
||||
pnp_exit_ext_func_mode(dev);
|
||||
}
|
122
superio/winbond/w83627thg/superio.c
Normal file
122
superio/winbond/w83627thg/superio.c
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2000 AG Electronics Ltd.
|
||||
* Copyright 2003-2004 Linux Networx
|
||||
* Copyright 2004 Tyan
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <lib.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pnp.h>
|
||||
#include <console.h>
|
||||
#include <string.h>
|
||||
//#include <bitops.h>
|
||||
#include <uart8250.h>
|
||||
#include <keyboard.h>
|
||||
// #include <pc80/mc146818rtc.h>
|
||||
#include <statictree.h>
|
||||
#include "w83627hf.h"
|
||||
|
||||
static void w83627thg_enter_ext_func_mode(struct device * dev)
|
||||
{
|
||||
outb(0x87, dev->path.u.pnp.port);
|
||||
outb(0x87, dev->path.u.pnp.port);
|
||||
}
|
||||
static void w83627thg_exit_ext_func_mode(struct device * dev)
|
||||
{
|
||||
outb(0xaa, dev->path.u.pnp.port);
|
||||
}
|
||||
|
||||
static void w83627thg_init(struct device * dev)
|
||||
{
|
||||
struct superio_winbond_w83627thg_config *conf;
|
||||
struct resource *res0, *res1;
|
||||
/* Wishlist handle well known programming interfaces more
|
||||
* generically.
|
||||
*/
|
||||
if (!dev->enabled) {
|
||||
return;
|
||||
}
|
||||
conf = dev->device_configuration;
|
||||
switch(dev->path.u.pnp.device) {
|
||||
case W83627THG_SP1:
|
||||
res0 = find_resource(dev, PNP_IDX_IO0);
|
||||
init_uart8250(res0->base, &conf->com1);
|
||||
break;
|
||||
case W83627THG_SP2:
|
||||
res0 = find_resource(dev, PNP_IDX_IO0);
|
||||
init_uart8250(res0->base, &conf->com2);
|
||||
break;
|
||||
case W83627THG_KBC:
|
||||
res0 = find_resource(dev, PNP_IDX_IO0);
|
||||
res1 = find_resource(dev, PNP_IDX_IO1);
|
||||
init_pc_keyboard(res0->base, res1->base, &conf->keyboard);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void w83627thg_set_resources(struct device * dev)
|
||||
{
|
||||
w83627thg_enter_ext_func_mode(dev);
|
||||
pnp_set_resources(dev);
|
||||
w83627thg_exit_ext_func_mode(dev);
|
||||
}
|
||||
|
||||
static void w83627thg_enable_resources(struct device * dev)
|
||||
{
|
||||
w83627thg_enter_ext_func_mode(dev);
|
||||
pnp_enable_resources(dev);
|
||||
w83627thg_exit_ext_func_mode(dev);
|
||||
}
|
||||
|
||||
static void w83627thg_enable(struct device * dev)
|
||||
{
|
||||
w83627thg_enter_ext_func_mode(dev);
|
||||
pnp_enable(dev);
|
||||
w83627thg_exit_ext_func_mode(dev);
|
||||
}
|
||||
|
||||
static void phase3_chip_setup_dev(struct device *dev);
|
||||
static struct device_operations w83627thg_ops = {
|
||||
.phase3_chip_setup_dev = phase3_chip_setup_dev,
|
||||
.phase3_enable = w83627thg_enable,
|
||||
.phase4_read_resources = pnp_read_resources,
|
||||
.phase4_set_resources = w83627thg_set_resources,
|
||||
.phase5_enable_resources = w83627thg_enable_resources,
|
||||
.enable = ,
|
||||
.init = w83627thg_init,
|
||||
};
|
||||
|
||||
static struct pnp_info pnp_dev_info[] = {
|
||||
{ &ops, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
|
||||
{ &ops, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
|
||||
{ &ops, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
|
||||
{ &ops, W83627THG_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
|
||||
// No 4 { 0,},
|
||||
{ &ops, W83627THG_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
|
||||
{ &ops, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
|
||||
{ &ops, W83627THG_GPIO2,},
|
||||
{ &ops, W83627THG_GPIO3,},
|
||||
{ &ops, W83627THG_ACPI, PNP_IRQ0, },
|
||||
{ &ops, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, { 0xff8, 0 } },
|
||||
};
|
||||
|
||||
static void phase3_chip_setup_dev(struct device *dev)
|
||||
{
|
||||
pnp_enable_devices(dev, &w83627thg_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
|
||||
}
|
29
superio/winbond/w83627thg/w83627thg.h
Normal file
29
superio/winbond/w83627thg/w83627thg.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2000 AG Electronics Ltd.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#define W83627THG_FDC 0 /* Floppy */
|
||||
#define W83627THG_PP 1 /* Parallel Port */
|
||||
#define W83627THG_SP1 2 /* Com1 */
|
||||
#define W83627THG_SP2 3 /* Com2 */
|
||||
#define W83627THG_KBC 5 /* Keyboard & Mouse */
|
||||
#define W83627THG_GAME_MIDI_GPIO1 7
|
||||
#define W83627THG_GPIO2 8
|
||||
#define W83627THG_GPIO3 9
|
||||
#define W83627THG_ACPI 10
|
||||
#define W83627THG_HWM 11 /* Hardware Monitor */
|
Loading…
Add table
Reference in a new issue