tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / superio / smsc / sch4037 / sch4037_early_init.c
blobeea9dce5b2fde0da96795c6a8f559b2dee4631c6
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2012 Advanced Micro Devices, Inc.
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; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <arch/io.h>
18 #include <device/pnp.h>
19 #include <stdint.h>
21 #include "sch4037.h"
23 static void pnp_enter_conf_state(pnp_devfn_t dev)
25 unsigned port = dev >> 8;
26 outb(0x55, port);
29 static void pnp_exit_conf_state(pnp_devfn_t dev)
31 unsigned port = dev >> 8;
32 outb(0xaa, port);
35 void sch4037_early_init(unsigned port)
37 pnp_devfn_t dev;
39 dev = PNP_DEV(port, SMSCSUPERIO_SP1);
40 pnp_enter_conf_state(dev);
42 /* Auto power management */
43 pnp_write_config(dev, 0x22, 0x38); /* BIT3+BIT4+BIT5 */
44 pnp_write_config(dev, 0x23, 0 );
46 /* Enable SMSC UART 0 */
47 dev = PNP_DEV(port, SMSCSUPERIO_SP1);
48 pnp_set_logical_device(dev);
49 pnp_set_enable(dev, 0);
51 pnp_set_iobase(dev, PNP_IDX_IO0, CONFIG_TTYS0_BASE);
52 pnp_set_irq(dev, PNP_IDX_IRQ0, 0x4);
54 /* Enabled High speed, disabled MIDI support. */
55 pnp_write_config(dev, 0xF0, 0x02);
56 pnp_set_enable(dev, 1);
58 /* Enable keyboard */
59 dev = PNP_DEV(port, SCH4037_KBC);
60 pnp_set_logical_device(dev);
61 pnp_set_enable(dev, 0);
62 pnp_set_irq(dev, 0x70, 1); /* IRQ 1 */
63 pnp_set_irq(dev, 0x72, 12); /* IRQ 12 */
64 pnp_set_enable(dev, 1);
66 pnp_exit_conf_state(dev);