Samuel Holland | d429c1a | 2020-08-17 23:44:41 -0500 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #include <device/device.h> |
| 4 | #include <device/pnp.h> |
| 5 | #include <pc80/keyboard.h> |
| 6 | #include "wpcd376i.h" |
| 7 | |
| 8 | static void init(struct device *dev) |
| 9 | { |
| 10 | if (!dev->enabled) |
| 11 | return; |
| 12 | |
| 13 | switch (dev->path.pnp.device) { |
| 14 | case WPCD376I_KBCK: |
| 15 | pc_keyboard_init(NO_AUX_DEVICE); |
| 16 | break; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | static struct device_operations ops = { |
| 21 | .read_resources = pnp_read_resources, |
| 22 | .set_resources = pnp_set_resources, |
| 23 | .enable_resources = pnp_enable_resources, |
| 24 | .enable = pnp_enable, |
| 25 | .init = init, |
| 26 | }; |
| 27 | |
| 28 | static struct pnp_info pnp_dev_info[] = { |
| 29 | { NULL, WPCD376I_FDC, |
| 30 | PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_MSC0 | PNP_MSC1 | PNP_MSC8, |
| 31 | 0x07f8, }, |
| 32 | { NULL, WPCD376I_LPT, |
| 33 | PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_MSC0 | PNP_MSC8, |
| 34 | 0x03f8, }, |
| 35 | { NULL, WPCD376I_SP1, |
| 36 | PNP_IO0 | PNP_IRQ0 | PNP_MSC0, |
| 37 | 0x07f8, }, |
| 38 | { NULL, WPCD376I_SWC, |
| 39 | PNP_IO0 | PNP_IO1 | PNP_IRQ0, |
| 40 | 0xfff0, 0xfff0, }, |
| 41 | { NULL, WPCD376I_KBCM, |
| 42 | PNP_IRQ0, }, |
| 43 | { NULL, WPCD376I_KBCK, |
| 44 | PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_MSC0, |
| 45 | 0x07f8, 0x07f8, }, |
| 46 | { NULL, WPCD376I_GPIO, |
| 47 | PNP_IO0 | PNP_IRQ0 | PNP_MSC0 | PNP_MSC1 | PNP_MSC2 | PNP_MSC3 | |
| 48 | PNP_MSC8, |
| 49 | 0xffe0, }, |
| 50 | { NULL, WPCD376I_ECIR, |
| 51 | PNP_IO0 | PNP_IO1 | PNP_IRQ0, |
| 52 | 0xfff0, 0xfff0, }, |
| 53 | { NULL, WPCD376I_IR, |
| 54 | PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1 | PNP_MSC0, |
| 55 | 0xfff8, }, |
| 56 | }; |
| 57 | |
| 58 | static void enable_dev(struct device *dev) |
| 59 | { |
| 60 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 61 | } |
| 62 | |
| 63 | struct chip_operations superio_winbond_wpcd376i_ops = { |
| 64 | CHIP_NAME("Winbond WPCD376I Super I/O") |
| 65 | .enable_dev = enable_dev, |
| 66 | }; |