Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 2 | |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pnp.h> |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 5 | #include <pc80/keyboard.h> |
Elyes HAOUAS | 2329a25 | 2019-05-15 22:11:18 +0200 | [diff] [blame] | 6 | |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 7 | #include "wpcm450.h" |
| 8 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 9 | static void init(struct device *dev) |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 10 | { |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 11 | if (!dev->enabled) |
| 12 | return; |
| 13 | |
Elyes HAOUAS | 0ce41f1 | 2018-11-13 10:03:31 +0100 | [diff] [blame] | 14 | switch (dev->path.pnp.device) { |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 15 | case WPCM450_KBCK: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 16 | pc_keyboard_init(NO_AUX_DEVICE); |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 17 | break; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | static struct device_operations ops = { |
| 22 | .read_resources = pnp_read_resources, |
| 23 | .set_resources = pnp_set_resources, |
| 24 | .enable_resources = pnp_enable_resources, |
| 25 | .enable = pnp_enable, |
| 26 | .init = init, |
| 27 | }; |
| 28 | |
| 29 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | 9911d64 | 2018-07-06 20:55:53 +0200 | [diff] [blame] | 30 | { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, |
| 31 | 0x07f8, }, |
| 32 | { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
Felix Held | b91b0cc | 2019-01-16 14:00:49 +0100 | [diff] [blame] | 33 | { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, }, |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | static void enable_dev(struct device *dev) |
| 37 | { |
| 38 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 39 | } |
| 40 | |
| 41 | struct chip_operations superio_nuvoton_wpcm450_ops = { |
Nicholas Sudsgaard | bfb11be | 2024-01-30 09:53:46 +0900 | [diff] [blame] | 42 | .name = "Nuvoton WPCM450 Super I/O", |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 43 | .enable_dev = enable_dev, |
| 44 | }; |