Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +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 | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 4 | * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de> |
| 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. |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Jon Dufresne | 39b13f4 | 2006-12-01 09:41:11 +0000 | [diff] [blame] | 17 | #include <device/device.h> |
| 18 | #include <device/pnp.h> |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 19 | #include <pc80/keyboard.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 20 | #include <stdlib.h> |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 21 | #include "it8718f.h" |
| 22 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 23 | static void init(struct device *dev) |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 24 | { |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 25 | |
Uwe Hermann | 5c6bae2 | 2010-11-08 15:16:30 +0000 | [diff] [blame] | 26 | if (!dev->enabled) |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 27 | return; |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 28 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 29 | switch (dev->path.pnp.device) { |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 30 | case IT8718F_FDC: /* TODO. */ |
| 31 | break; |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 32 | case IT8718F_PP: /* TODO. */ |
| 33 | break; |
| 34 | case IT8718F_EC: /* TODO. */ |
| 35 | break; |
| 36 | case IT8718F_KBCK: |
Edward O'Callaghan | def00be | 2014-04-30 05:01:52 +1000 | [diff] [blame] | 37 | pc_keyboard_init(); |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 38 | break; |
| 39 | case IT8718F_KBCM: /* TODO. */ |
| 40 | break; |
| 41 | case IT8718F_IR: /* TODO. */ |
| 42 | break; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | static struct device_operations ops = { |
| 47 | .read_resources = pnp_read_resources, |
| 48 | .set_resources = pnp_set_resources, |
| 49 | .enable_resources = pnp_enable_resources, |
| 50 | .enable = pnp_enable, |
| 51 | .init = init, |
| 52 | }; |
| 53 | |
Damien Zammit | 9074cec | 2015-12-28 23:34:00 +1100 | [diff] [blame] | 54 | /* TODO: IR. */ |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 55 | static struct pnp_info pnp_dev_info[] = { |
Damien Zammit | 9074cec | 2015-12-28 23:34:00 +1100 | [diff] [blame] | 56 | { &ops, IT8718F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 |
| 57 | | PNP_MSC0 | PNP_MSC1, {0x0ff8, 0}, }, |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 58 | { &ops, IT8718F_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
Damien Zammit | 9074cec | 2015-12-28 23:34:00 +1100 | [diff] [blame] | 59 | { &ops, IT8718F_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 60 | { &ops, IT8718F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 |
| 61 | | PNP_MSC0 | PNP_MSC1 | PNP_MSC2 | PNP_MSC3 |
| 62 | | PNP_MSC4 | PNP_MSC5 | PNP_MSC6, |
| 63 | {0x0ff8, 0}, {0x0ff8, 4}, }, |
| 64 | { &ops, IT8718F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0 |
| 65 | | PNP_MSC0, {0x07f8, 0}, {0x07f8, 4}, }, |
| 66 | { &ops, IT8718F_KBCM, PNP_IRQ0 | PNP_MSC0, }, |
| 67 | { &ops, IT8718F_PP, PNP_IO0 | PNP_IO1 | PNP_IRQ0 |
| 68 | | PNP_DRQ0 | PNP_MSC0, {0x0ff8, 0}, {0x0ff8, 4}, }, |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | static void enable_dev(struct device *dev) |
| 72 | { |
| 73 | pnp_enable_devices(dev, &pnp_ops, |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 74 | ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Uwe Hermann | f28674e | 2006-11-01 12:52:49 +0000 | [diff] [blame] | 77 | struct chip_operations superio_ite_it8718f_ops = { |
Uwe Hermann | a7aa29b | 2006-11-05 18:50:49 +0000 | [diff] [blame] | 78 | CHIP_NAME("ITE IT8718F Super I/O") |
Stefan Reinauer | 61be08b | 2006-08-29 17:41:14 +0000 | [diff] [blame] | 79 | .enable_dev = enable_dev, |
| 80 | }; |