Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 3 | * |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 4 | * Copyright (C) 2000 AG Electronics Ltd. |
| 5 | * Copyright (C) 2003-2004 Linux Networx |
| 6 | * Copyright (C) 2004 Tyan |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 7 | * Copyright (C) 2005 Digital Design Corporation |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 8 | * Copyright (C) 2006 Ron Minnich, LANL |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 21 | #include <device/device.h> |
| 22 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 23 | #include <superio/conf_mode.h> |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 24 | #include <device/smbus.h> |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 25 | #include <pc80/keyboard.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 26 | #include <stdlib.h> |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 27 | #include "lpc47m10x.h" |
| 28 | |
Edward O'Callaghan | 520a328 | 2015-01-04 16:28:37 +1100 | [diff] [blame] | 29 | /** |
| 30 | * Initialize the specified Super I/O device. |
| 31 | * |
| 32 | * Devices other than COM ports and the keyboard controller are ignored. |
| 33 | * For COM ports, we configure the baud rate. |
| 34 | * |
| 35 | * @param dev Pointer to structure describing a Super I/O device. |
| 36 | */ |
| 37 | static void lpc47m10x_init(struct device *dev) |
| 38 | { |
| 39 | if (!dev->enabled) |
| 40 | return; |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 41 | |
Elyes HAOUAS | 0ce41f1 | 2018-11-13 10:03:31 +0100 | [diff] [blame] | 42 | switch (dev->path.pnp.device) { |
Edward O'Callaghan | 520a328 | 2015-01-04 16:28:37 +1100 | [diff] [blame] | 43 | case LPC47M10X2_KBC: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 44 | pc_keyboard_init(NO_AUX_DEVICE); |
Edward O'Callaghan | 520a328 | 2015-01-04 16:28:37 +1100 | [diff] [blame] | 45 | break; |
| 46 | } |
| 47 | } |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 48 | |
| 49 | static struct device_operations ops = { |
| 50 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 51 | .set_resources = pnp_set_resources, |
| 52 | .enable_resources = pnp_enable_resources, |
| 53 | .enable = pnp_alt_enable, |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 54 | .init = lpc47m10x_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 55 | .ops_pnp_mode = &pnp_conf_mode_55_aa, |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | b0d868e | 2018-07-06 23:39:00 +0200 | [diff] [blame] | 59 | { NULL, LPC47M10X2_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 60 | { NULL, LPC47M10X2_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 61 | { NULL, LPC47M10X2_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 62 | { NULL, LPC47M10X2_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 63 | { NULL, LPC47M10X2_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, |
| 64 | 0x07ff, 0x07ff, }, |
| 65 | { NULL, LPC47M10X2_PME, PNP_IO0, 0x0f80, }, |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 68 | /** |
| 69 | * Create device structures and allocate resources to devices specified in the |
| 70 | * pnp_dev_info array (above). |
| 71 | * |
| 72 | * @param dev Pointer to structure describing a Super I/O device. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 73 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 74 | static void enable_dev(struct device *dev) |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 75 | { |
Felix Held | b0d868e | 2018-07-06 23:39:00 +0200 | [diff] [blame] | 76 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Edward O'Callaghan | 520a328 | 2015-01-04 16:28:37 +1100 | [diff] [blame] | 79 | struct chip_operations superio_smsc_lpc47m10x_ops = { |
| 80 | CHIP_NAME("SMSC LPC47M10x Super I/O") |
| 81 | .enable_dev = enable_dev |
| 82 | }; |