Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2000 AG Electronics Ltd. |
| 5 | * Copyright (C) 2003-2004 Linux Networx |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 16 | */ |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 17 | |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 18 | #include <device/device.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 19 | #include <device/pnp.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 20 | #include <pc80/keyboard.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 21 | #include <stdlib.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 22 | #include "pc87360.h" |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 23 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 24 | static void init(struct device *dev) |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 25 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 26 | if (!dev->enabled) |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 27 | return; |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 28 | |
Elyes HAOUAS | 0ce41f1 | 2018-11-13 10:03:31 +0100 | [diff] [blame] | 29 | switch (dev->path.pnp.device) { |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 30 | case PC87360_KBCK: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 31 | pc_keyboard_init(NO_AUX_DEVICE); |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 32 | break; |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 33 | } |
| 34 | } |
| 35 | |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 36 | static struct device_operations ops = { |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 37 | .read_resources = pnp_read_resources, |
| 38 | .set_resources = pnp_set_resources, |
| 39 | .enable_resources = pnp_enable_resources, |
| 40 | .enable = pnp_enable, |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 41 | .init = init, |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 44 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | d5292bf | 2019-01-16 13:23:35 +0100 | [diff] [blame] | 45 | { NULL, PC87360_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 46 | { NULL, PC87360_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
Felix Held | faca0bc | 2017-12-27 22:51:29 +0100 | [diff] [blame] | 47 | { NULL, PC87360_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, |
| 48 | 0x07f8, }, |
| 49 | { NULL, PC87360_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 50 | { NULL, PC87360_SWC, PNP_IO0 | PNP_IRQ0, 0xfff0, }, |
| 51 | { NULL, PC87360_KBCM, PNP_IRQ0, }, |
| 52 | { NULL, PC87360_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, }, |
| 53 | { NULL, PC87360_GPIO, PNP_IO0 | PNP_IRQ0, 0xfff8, }, |
| 54 | { NULL, PC87360_ACB, PNP_IO0 | PNP_IRQ0, 0xfff8, }, |
| 55 | { NULL, PC87360_FSCM, PNP_IO0 | PNP_IRQ0, 0xfff8, }, |
| 56 | { NULL, PC87360_WDT, PNP_IO0 | PNP_IRQ0, 0xfffc, }, |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
Eric Biederman | 7003ba4 | 2004-10-16 06:20:29 +0000 | [diff] [blame] | 59 | static void enable_dev(struct device *dev) |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 60 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 61 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 62 | } |
| 63 | |
Uwe Hermann | d86417b | 2006-10-24 23:00:42 +0000 | [diff] [blame] | 64 | struct chip_operations superio_nsc_pc87360_ops = { |
Uwe Hermann | a7aa29b | 2006-11-05 18:50:49 +0000 | [diff] [blame] | 65 | CHIP_NAME("NSC PC87360 Super I/O") |
Eric Biederman | 7003ba4 | 2004-10-16 06:20:29 +0000 | [diff] [blame] | 66 | .enable_dev = enable_dev, |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 67 | }; |