blob: bb7dc7ef92ce25062c86166b90c26057bc8692d5 [file] [log] [blame]
Ed Swierk62eee3f2008-03-16 23:31:04 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008 Arastra, Inc.
5 *
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.
Ed Swierk62eee3f2008-03-16 23:31:04 +000015 */
16
17#include <stdlib.h>
18#include <device/device.h>
19#include <device/pnp.h>
Ed Swierk62eee3f2008-03-16 23:31:04 +000020#include "i3100.h"
21#include <arch/io.h>
22
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110023static void pnp_enter_ext_func_mode(struct device *dev)
Ed Swierk62eee3f2008-03-16 23:31:04 +000024{
Stefan Reinauer2b34db82009-02-28 20:10:20 +000025 outb(0x80, dev->path.pnp.port);
26 outb(0x86, dev->path.pnp.port);
Ed Swierk62eee3f2008-03-16 23:31:04 +000027}
28
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110029static void pnp_exit_ext_func_mode(struct device *dev)
Ed Swierk62eee3f2008-03-16 23:31:04 +000030{
Stefan Reinauer2b34db82009-02-28 20:10:20 +000031 outb(0x68, dev->path.pnp.port);
32 outb(0x08, dev->path.pnp.port);
Ed Swierk62eee3f2008-03-16 23:31:04 +000033}
34
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110035static void i3100_init(struct device *dev)
Ed Swierk62eee3f2008-03-16 23:31:04 +000036{
Uwe Hermann7d341882010-11-05 00:07:13 +000037 if (!dev->enabled)
Ed Swierk62eee3f2008-03-16 23:31:04 +000038 return;
Ed Swierk62eee3f2008-03-16 23:31:04 +000039}
40
Nico Huber13dc9762013-06-15 19:33:15 +020041static const struct pnp_mode_ops pnp_conf_mode_ops = {
42 .enter_conf_mode = pnp_enter_ext_func_mode,
43 .exit_conf_mode = pnp_exit_ext_func_mode,
44};
45
Ed Swierk62eee3f2008-03-16 23:31:04 +000046static struct device_operations ops = {
47 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020048 .set_resources = pnp_set_resources,
49 .enable_resources = pnp_enable_resources,
50 .enable = pnp_alt_enable,
Ed Swierk62eee3f2008-03-16 23:31:04 +000051 .init = i3100_init,
Nico Huber13dc9762013-06-15 19:33:15 +020052 .ops_pnp_mode = &pnp_conf_mode_ops,
Ed Swierk62eee3f2008-03-16 23:31:04 +000053};
54
55static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000056 { &ops, I3100_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
57 { &ops, I3100_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
Ed Swierk62eee3f2008-03-16 23:31:04 +000058};
59
60static void enable_dev(struct device *dev)
61{
62 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
63}
64
65struct chip_operations superio_intel_i3100_ops = {
66 CHIP_NAME("Intel 3100 Super I/O")
67 .enable_dev = enable_dev,
68};