blob: cd138541288abbba651e851286483d0665ba3917 [file] [log] [blame]
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +00001/*
Uwe Hermanna69d9782010-11-15 19:35:14 +00002 * This file is part of the coreboot project.
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +00003 *
Uwe Hermanna69d9782010-11-15 19:35:14 +00004 * Copyright (C) 2000 AG Electronics Ltd.
5 * Copyright (C) 2003-2004 Linux Networx
6 * Copyright (C) 2004 Tyan
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +00007 * Copyright (C) 2005 Digital Design Corporation
Uwe Hermanna69d9782010-11-15 19:35:14 +00008 * Copyright (C) 2006 Ron Minnich, LANL
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +00009 *
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. Minnich8a02b7d2006-08-17 20:31:09 +000019 */
20
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000021#include <device/device.h>
22#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020023#include <superio/conf_mode.h>
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000024#include <device/smbus.h>
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000025#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000026#include <stdlib.h>
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000027#include "lpc47m10x.h"
28
Edward O'Callaghan520a3282015-01-04 16:28:37 +110029/**
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 */
37static void lpc47m10x_init(struct device *dev)
38{
39 if (!dev->enabled)
40 return;
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000041
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010042 switch (dev->path.pnp.device) {
Edward O'Callaghan520a3282015-01-04 16:28:37 +110043 case LPC47M10X2_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060044 pc_keyboard_init(NO_AUX_DEVICE);
Edward O'Callaghan520a3282015-01-04 16:28:37 +110045 break;
46 }
47}
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000048
49static struct device_operations ops = {
50 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020051 .set_resources = pnp_set_resources,
52 .enable_resources = pnp_enable_resources,
53 .enable = pnp_alt_enable,
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000054 .init = lpc47m10x_init,
Nico Huber1c811282013-06-15 20:33:44 +020055 .ops_pnp_mode = &pnp_conf_mode_55_aa,
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000056};
57
58static struct pnp_info pnp_dev_info[] = {
Felix Heldb0d868e2018-07-06 23:39:00 +020059 { 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. Minnich8a02b7d2006-08-17 20:31:09 +000066};
67
Uwe Hermannb69cb5a2010-10-26 22:46:43 +000068/**
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 Bao9db833b2009-12-28 09:59:44 +000073 */
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110074static void enable_dev(struct device *dev)
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000075{
Felix Heldb0d868e2018-07-06 23:39:00 +020076 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Ronald G. Minnich8a02b7d2006-08-17 20:31:09 +000077}
78
Edward O'Callaghan520a3282015-01-04 16:28:37 +110079struct chip_operations superio_smsc_lpc47m10x_ops = {
80 CHIP_NAME("SMSC LPC47M10x Super I/O")
81 .enable_dev = enable_dev
82};