Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Advanced Micro Devices, 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. |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 17 | #include <device/device.h> |
| 18 | #include <device/pnp.h> |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 19 | #include <pc80/keyboard.h> |
| 20 | #include <stdlib.h> |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 21 | #include "wpcm450.h" |
| 22 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 23 | static void init(struct device *dev) |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 24 | { |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 25 | |
| 26 | if (!dev->enabled) |
| 27 | return; |
| 28 | |
Elyes HAOUAS | 0ce41f1 | 2018-11-13 10:03:31 +0100 | [diff] [blame] | 29 | switch (dev->path.pnp.device) { |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 30 | case WPCM450_KBCK: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 31 | pc_keyboard_init(NO_AUX_DEVICE); |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 32 | break; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | static struct device_operations ops = { |
| 37 | .read_resources = pnp_read_resources, |
| 38 | .set_resources = pnp_set_resources, |
| 39 | .enable_resources = pnp_enable_resources, |
| 40 | .enable = pnp_enable, |
| 41 | .init = init, |
| 42 | }; |
| 43 | |
| 44 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | 9911d64 | 2018-07-06 20:55:53 +0200 | [diff] [blame] | 45 | { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, |
| 46 | 0x07f8, }, |
| 47 | { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
Felix Held | b91b0cc | 2019-01-16 14:00:49 +0100 | [diff] [blame] | 48 | { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, }, |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | static void enable_dev(struct device *dev) |
| 52 | { |
| 53 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 54 | } |
| 55 | |
| 56 | struct chip_operations superio_nuvoton_wpcm450_ops = { |
Paul Menzel | 87eacac | 2014-06-05 07:52:49 +0200 | [diff] [blame] | 57 | CHIP_NAME("Nuvoton WPCM450 Super I/O") |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 58 | .enable_dev = enable_dev, |
| 59 | }; |