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 | |
| 17 | #include <arch/io.h> |
| 18 | #include <device/device.h> |
| 19 | #include <device/pnp.h> |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +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> |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 22 | #include "pc87309.h" |
| 23 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 24 | static void init(struct device *dev) |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 25 | { |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 26 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 27 | if (!dev->enabled) |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 28 | return; |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 29 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 30 | switch (dev->path.pnp.device) { |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 31 | case PC87309_KBCK: |
Edward O'Callaghan | def00be | 2014-04-30 05:01:52 +1000 | [diff] [blame] | 32 | pc_keyboard_init(); |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 33 | break; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | static struct device_operations ops = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 38 | .read_resources = pnp_read_resources, |
| 39 | .set_resources = pnp_set_resources, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 40 | .enable_resources = pnp_enable_resources, |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 41 | .enable = pnp_enable, |
| 42 | .init = init, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 46 | { &ops, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, }, |
| 47 | { &ops, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, }, |
| 48 | { &ops, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, }, |
| 49 | { &ops, PC87309_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 50 | /* TODO: PM. */ |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 51 | { &ops, PC87309_KBCM, PNP_IRQ0, }, |
| 52 | { &ops, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x7f8, 4}, }, |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | static void enable_dev(struct device *dev) |
| 56 | { |
| 57 | pnp_enable_devices(dev, &pnp_ops, |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 58 | ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Uwe Hermann | 3a66263 | 2007-03-31 19:45:24 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | struct chip_operations superio_nsc_pc87309_ops = { |
| 62 | CHIP_NAME("NSC PC87309 Super I/O") |
| 63 | .enable_dev = enable_dev, |
| 64 | }; |