Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [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 | * Copyright (C) 2004 Tyan |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #include <arch/io.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pnp.h> |
| 22 | #include <superio/conf_mode.h> |
| 23 | #include <console/console.h> |
| 24 | #include <device/smbus.h> |
| 25 | #include <string.h> |
| 26 | #include <pc80/keyboard.h> |
| 27 | #include <stdlib.h> |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 28 | #include "dme1737.h" |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 29 | |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 30 | static void dme1737_init(struct device *dev) |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 31 | { |
| 32 | |
| 33 | if (!dev->enabled) |
| 34 | return; |
| 35 | |
| 36 | switch(dev->path.pnp.device) { |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 37 | case DME1737_KBC: |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 38 | pc_keyboard_init(); |
| 39 | break; |
| 40 | } |
| 41 | } |
| 42 | |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 43 | static struct device_operations ops = { |
| 44 | .read_resources = pnp_read_resources, |
| 45 | .set_resources = pnp_set_resources, |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 46 | .enable_resources = pnp_enable_resources, |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 47 | .enable = pnp_alt_enable, |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 48 | .init = dme1737_init, |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 49 | .ops_pnp_mode = &pnp_conf_mode_55_aa, |
| 50 | }; |
| 51 | |
| 52 | static struct pnp_info pnp_dev_info[] = { |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 53 | { &ops, DME1737_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, }, |
| 54 | { &ops, DME1737_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, }, |
| 55 | { &ops, DME1737_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 56 | { &ops, DME1737_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 57 | { &ops, DME1737_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, {0x07ff, 0}, {0x07ff, 4}, }, |
| 58 | { &ops, DME1737_RT, PNP_IO0, {0x0780, 0}, }, |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | static void enable_dev(struct device *dev) |
| 62 | { |
| 63 | pnp_enable_devices(dev, &pnp_ops, |
| 64 | ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 65 | } |
| 66 | |
Jonathan A. Kollasch | 260a01f | 2015-07-12 11:49:16 -0500 | [diff] [blame] | 67 | struct chip_operations superio_smsc_dme1737_ops = { |
| 68 | CHIP_NAME("SMSC DME1737 Super I/O") |
Jonathan A. Kollasch | 8964717 | 2015-07-12 11:47:56 -0500 | [diff] [blame] | 69 | .enable_dev = enable_dev, |
| 70 | }; |