Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Uwe Hermann | a4c56c3 | 2006-11-01 14:31:00 +0000 | [diff] [blame] | 3 | * |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 4 | * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de> |
Philipp Degler | 4adc742 | 2007-05-24 18:44:50 +0000 | [diff] [blame] | 5 | * Copyright (C) 2007 Philipp Degler <pdegler@rumms.uni-mannheim.de> |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 6 | * |
| 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; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Jon Dufresne | 39b13f4 | 2006-12-01 09:41:11 +0000 | [diff] [blame] | 18 | #include <device/device.h> |
| 19 | #include <device/pnp.h> |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 20 | #include <pc80/keyboard.h> |
Philipp Degler | 4adc742 | 2007-05-24 18:44:50 +0000 | [diff] [blame] | 21 | #include <arch/io.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 22 | #include <stdlib.h> |
Edward O'Callaghan | 0f7ec31 | 2014-11-01 12:11:58 +1100 | [diff] [blame] | 23 | #include <superio/conf_mode.h> |
| 24 | |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 25 | #include "it8712f.h" |
| 26 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 27 | static void it8712f_init(struct device *dev) |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 28 | { |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 29 | |
Uwe Hermann | 5c6bae2 | 2010-11-08 15:16:30 +0000 | [diff] [blame] | 30 | if (!dev->enabled) |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 31 | return; |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 32 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 33 | switch (dev->path.pnp.device) { |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 34 | case IT8712F_FDC: /* TODO. */ |
| 35 | break; |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 36 | case IT8712F_PP: /* TODO. */ |
| 37 | break; |
| 38 | case IT8712F_EC: /* TODO. */ |
| 39 | break; |
| 40 | case IT8712F_KBCK: |
Marc Jones | ecd176f | 2008-09-26 19:15:38 +0000 | [diff] [blame] | 41 | set_kbc_ps2_mode(); |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 42 | pc_keyboard_init(NO_AUX_DEVICE); |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 43 | break; |
| 44 | case IT8712F_KBCM: /* TODO. */ |
| 45 | break; |
| 46 | case IT8712F_MIDI: /* TODO. */ |
| 47 | break; |
| 48 | case IT8712F_GAME: /* TODO. */ |
| 49 | break; |
| 50 | case IT8712F_IR: /* TODO. */ |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | static struct device_operations ops = { |
Nico Huber | 9cb0941 | 2013-06-15 15:30:19 +0200 | [diff] [blame] | 56 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 57 | .set_resources = pnp_set_resources, |
| 58 | .enable_resources = pnp_enable_resources, |
| 59 | .enable = pnp_alt_enable, |
Nico Huber | 9cb0941 | 2013-06-15 15:30:19 +0200 | [diff] [blame] | 60 | .init = it8712f_init, |
Edward O'Callaghan | 0f7ec31 | 2014-11-01 12:11:58 +1100 | [diff] [blame] | 61 | .ops_pnp_mode = &pnp_conf_mode_870155_aa, |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 64 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 65 | { &ops, IT8712F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x0ff8, 0}, }, |
| 66 | { &ops, IT8712F_SP1, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, |
| 67 | { &ops, IT8712F_SP2, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, |
| 68 | { &ops, IT8712F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x0ffc, 0}, }, |
| 69 | { &ops, IT8712F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0ff8, 0}, {0x0ff8, 4}, }, |
| 70 | { &ops, IT8712F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0fff, 0}, {0x0fff, 4}, }, |
| 71 | { &ops, IT8712F_KBCM, PNP_IRQ0, }, |
| 72 | { &ops, IT8712F_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0, {0x0fff, 0}, {0x0ff8, 0}, {0x0ff8, 0}, }, |
| 73 | { &ops, IT8712F_MIDI, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, |
| 74 | { &ops, IT8712F_GAME, PNP_IO0, {0x0fff, 0}, }, |
| 75 | { &ops, IT8712F_IR, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | static void enable_dev(struct device *dev) |
| 79 | { |
| 80 | pnp_enable_devices(dev, &pnp_ops, |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 81 | ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Uwe Hermann | f28674e | 2006-11-01 12:52:49 +0000 | [diff] [blame] | 84 | struct chip_operations superio_ite_it8712f_ops = { |
Uwe Hermann | a7aa29b | 2006-11-05 18:50:49 +0000 | [diff] [blame] | 85 | CHIP_NAME("ITE IT8712F Super I/O") |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 86 | .enable_dev = enable_dev, |
| 87 | }; |