Marc Jones | 721c407 | 2015-09-16 17:58:35 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2000 AG Electronics Ltd. |
| 5 | * Copyright (C) 2003-2004 Linux Networx |
| 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. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc. |
| 20 | */ |
| 21 | |
| 22 | #include <device/device.h> |
| 23 | #include <device/pnp.h> |
| 24 | #include <drivers/uart/uart8250reg.h> |
| 25 | #include <pc80/keyboard.h> |
| 26 | #include <arch/io.h> |
| 27 | #include <stdlib.h> |
| 28 | #include "chip.h" |
| 29 | #include "wpcd376i.h" |
| 30 | |
| 31 | static void init(device_t dev) |
| 32 | { |
| 33 | if (!dev->enabled) |
| 34 | return; |
| 35 | |
| 36 | switch (dev->path.pnp.device) { |
| 37 | |
| 38 | case WPCD376I_FDC: |
| 39 | case WPCD376I_LPT: |
| 40 | case WPCD376I_IR: |
| 41 | case WPCD376I_SP1: |
| 42 | case WPCD376I_SWC: |
| 43 | case WPCD376I_KBCM: |
| 44 | case WPCD376I_GPIO: |
| 45 | break; |
| 46 | |
| 47 | case WPCD376I_KBCK: |
| 48 | pc_keyboard_init(); |
| 49 | break; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | static struct device_operations ops = { |
| 54 | .read_resources = pnp_read_resources, |
| 55 | .set_resources = pnp_set_resources, |
| 56 | .enable_resources = pnp_enable_resources, |
| 57 | .enable = pnp_enable, |
| 58 | .init = init, |
| 59 | }; |
| 60 | |
| 61 | static struct pnp_info pnp_dev_info[] = { |
| 62 | { &ops, WPCD376I_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, }, |
| 63 | { &ops, WPCD376I_LPT, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, }, |
| 64 | { &ops, WPCD376I_IR, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, }, |
| 65 | { &ops, WPCD376I_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 66 | { &ops, WPCD376I_KBCM, PNP_IRQ0, }, |
| 67 | { &ops, WPCD376I_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, }, |
| 68 | { &ops, WPCD376I_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, }, |
| 69 | }; |
| 70 | |
| 71 | static void enable_dev(struct device *dev) |
| 72 | { |
| 73 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 74 | } |
| 75 | |
| 76 | struct chip_operations superio_winbond_wpcd376i_ops = { |
| 77 | CHIP_NAME("Winbond WPCD376I Super I/O") |
| 78 | .enable_dev = enable_dev, |
| 79 | }; |