Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Advanced Micro Devices, Inc. |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* RAM driver for the SMSC SIO1036 Super I/O chip */ |
| 17 | |
| 18 | #include <arch/io.h> |
| 19 | #include <device/device.h> |
| 20 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 21 | #include <superio/conf_mode.h> |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 22 | #include <console/console.h> |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 23 | #include <stdlib.h> |
Edward O'Callaghan | 4e9f5e3f | 2014-08-02 20:45:13 +1000 | [diff] [blame] | 24 | |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 25 | #include "sio1036.h" |
| 26 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 27 | static void sio1036_init(struct device *dev) |
Edward O'Callaghan | 4e9f5e3f | 2014-08-02 20:45:13 +1000 | [diff] [blame] | 28 | { |
| 29 | if (!dev->enabled) { |
| 30 | return; |
| 31 | } |
| 32 | } |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 33 | |
| 34 | static struct device_operations ops = { |
| 35 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 36 | .set_resources = pnp_set_resources, |
| 37 | .enable_resources = pnp_enable_resources, |
| 38 | .enable = pnp_alt_enable, |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 39 | .init = sio1036_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 40 | .ops_pnp_mode = &pnp_conf_mode_55_aa, |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static struct pnp_info pnp_dev_info[] = { |
Edward O'Callaghan | 4e9f5e3f | 2014-08-02 20:45:13 +1000 | [diff] [blame] | 44 | { &ops, SIO1036_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 45 | }; |
| 46 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 47 | static void enable_dev(struct device *dev) |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 48 | { |
Edward O'Callaghan | 4e9f5e3f | 2014-08-02 20:45:13 +1000 | [diff] [blame] | 49 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Kerry Sheh | 3c71a85 | 2012-02-07 20:31:40 +0800 | [diff] [blame] | 50 | } |
| 51 | |
Edward O'Callaghan | 4e9f5e3f | 2014-08-02 20:45:13 +1000 | [diff] [blame] | 52 | struct chip_operations superio_smsc_sio1036_ops = { |
| 53 | CHIP_NAME("SMSC SIO1036 Super I/O") |
| 54 | .enable_dev = enable_dev |
| 55 | }; |