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 | |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 18 | #include <arch/io.h> |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 19 | #include <device/device.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 20 | #include <device/pnp.h> |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 21 | #include <console/console.h> |
| 22 | #include <string.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 23 | #include <pc80/keyboard.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 24 | #include <stdlib.h> |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 25 | #include "pc87360.h" |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 26 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 27 | static void init(struct device *dev) |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 28 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 29 | if (!dev->enabled) |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 30 | return; |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 31 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 32 | switch(dev->path.pnp.device) { |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 33 | case PC87360_KBCK: |
Edward O'Callaghan | def00be | 2014-04-30 05:01:52 +1000 | [diff] [blame] | 34 | pc_keyboard_init(); |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 35 | break; |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 36 | } |
| 37 | } |
| 38 | |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 39 | static struct device_operations ops = { |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 40 | .read_resources = pnp_read_resources, |
| 41 | .set_resources = pnp_set_resources, |
| 42 | .enable_resources = pnp_enable_resources, |
| 43 | .enable = pnp_enable, |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 44 | .init = init, |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 47 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 48 | { &ops, PC87360_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, }, |
| 49 | { &ops, PC87360_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, }, |
| 50 | { &ops, PC87360_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, }, |
| 51 | { &ops, PC87360_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 52 | { &ops, PC87360_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, }, |
| 53 | { &ops, PC87360_KBCM, PNP_IRQ0, }, |
| 54 | { &ops, PC87360_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, }, |
| 55 | { &ops, PC87360_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, }, |
| 56 | { &ops, PC87360_ACB, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, }, |
| 57 | { &ops, PC87360_FSCM, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, }, |
| 58 | { &ops, PC87360_WDT, PNP_IO0 | PNP_IRQ0, {0xfffc, 0}, }, |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
Eric Biederman | 7003ba4 | 2004-10-16 06:20:29 +0000 | [diff] [blame] | 61 | static void enable_dev(struct device *dev) |
Eric Biederman | 0ac6b41 | 2003-09-02 17:16:48 +0000 | [diff] [blame] | 62 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 63 | 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] | 64 | } |
| 65 | |
Uwe Hermann | d86417b | 2006-10-24 23:00:42 +0000 | [diff] [blame] | 66 | struct chip_operations superio_nsc_pc87360_ops = { |
Uwe Hermann | a7aa29b | 2006-11-05 18:50:49 +0000 | [diff] [blame] | 67 | CHIP_NAME("NSC PC87360 Super I/O") |
Eric Biederman | 7003ba4 | 2004-10-16 06:20:29 +0000 | [diff] [blame] | 68 | .enable_dev = enable_dev, |
Ronald G. Minnich | 6a3a3e5 | 2003-06-30 17:23:35 +0000 | [diff] [blame] | 69 | }; |