Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 coresystems GmbH |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 16 | #include <device/device.h> |
| 17 | #include <device/pnp.h> |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 18 | #include <pc80/keyboard.h> |
Edward O'Callaghan | 49380b8 | 2014-06-16 16:48:44 +1000 | [diff] [blame] | 19 | #include <stdlib.h> |
| 20 | |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 21 | #include "fdc37n972.h" |
| 22 | |
Edward O'Callaghan | 2c9d2cf | 2014-10-27 23:29:29 +1100 | [diff] [blame] | 23 | static void init(struct device *dev) |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 24 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 25 | if (!dev->enabled) |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 26 | return; |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 27 | |
| 28 | switch (dev->path.pnp.device) { |
| 29 | case FDC37N972_FDC: /* TODO. */ |
| 30 | break; |
| 31 | case FDC37N972_PP: /* TODO. */ |
| 32 | break; |
| 33 | case FDC37N972_KBDC: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 34 | pc_keyboard_init(NO_AUX_DEVICE); |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 35 | break; |
| 36 | // [..] The rest: TODO |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | static struct device_operations ops = { |
| 41 | .read_resources = pnp_read_resources, |
| 42 | .set_resources = pnp_set_resources, |
| 43 | .enable_resources = pnp_enable_resources, |
| 44 | .enable = pnp_enable, |
| 45 | .init = init, |
| 46 | }; |
| 47 | |
| 48 | static struct pnp_info pnp_dev_info[] = { |
Samuel Holland | 7daac91 | 2017-06-06 22:55:01 -0500 | [diff] [blame] | 49 | { &ops, FDC37N972_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 50 | { &ops, FDC37N972_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, 0x07f8, }, |
| 51 | { &ops, FDC37N972_KBDC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, }, |
Stefan Reinauer | 9e7a5d4 | 2010-05-16 14:08:32 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | static void enable_dev(struct device *dev) |
| 55 | { |
| 56 | pnp_enable_devices(dev, &pnp_ops, |
| 57 | ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 58 | } |
| 59 | |
| 60 | struct chip_operations superio_smsc_fdc37n972_ops = { |
| 61 | CHIP_NAME("SMSC FDC37N972 Super I/O") |
| 62 | .enable_dev = enable_dev, |
| 63 | }; |