Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de> |
| 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. |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 17 | #include <device/device.h> |
| 18 | #include <device/pnp.h> |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 19 | #include <pc80/keyboard.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 20 | #include <stdlib.h> |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 21 | #include "pc87309.h" |
| 22 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 23 | static void init(struct device *dev) |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 24 | { |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 25 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 26 | if (!dev->enabled) |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 27 | return; |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 28 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 29 | switch (dev->path.pnp.device) { |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 30 | case PC87309_KBCK: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 31 | pc_keyboard_init(NO_AUX_DEVICE); |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 32 | break; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | static struct device_operations ops = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 37 | .read_resources = pnp_read_resources, |
| 38 | .set_resources = pnp_set_resources, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 39 | .enable_resources = pnp_enable_resources, |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 40 | .enable = pnp_enable, |
| 41 | .init = init, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | d5292bf | 2019-01-16 13:23:35 +0100 | [diff] [blame] | 45 | { NULL, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 46 | { NULL, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
Felix Held | faca0bc | 2017-12-27 22:51:29 +0100 | [diff] [blame] | 47 | { NULL, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, |
| 48 | 0x07f8, }, |
| 49 | { NULL, PC87309_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 50 | /* TODO: PM. */ |
Felix Held | faca0bc | 2017-12-27 22:51:29 +0100 | [diff] [blame] | 51 | { NULL, PC87309_KBCM, PNP_IRQ0, }, |
| 52 | { NULL, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x7f8, }, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | static void enable_dev(struct device *dev) |
| 56 | { |
Felix Held | faca0bc | 2017-12-27 22:51:29 +0100 | [diff] [blame] | 57 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | struct chip_operations superio_nsc_pc87309_ops = { |
| 61 | CHIP_NAME("NSC PC87309 Super I/O") |
| 62 | .enable_dev = enable_dev, |
| 63 | }; |