From 7b73e85283bea7f456ab2f86ed1d1099eb88bc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 8 Nov 2022 04:43:41 +0000 Subject: Revert "mb/aopen/dxplplusu: Remove board" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit eb76a455cd39ec59b7f2ba28baeec9538befd59e and applies minor fixes to make it build again. PARALLEL_MP was working prior to board removal and no relevant SMI handlers were implemented. So NO_SMM choice is now selected. Change-Id: Ia1cd02278240d1b5d006fb2a7730d3d86390f85b Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/69339 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/superio/smsc/lpc47m10x/Kconfig | 4 ++ src/superio/smsc/lpc47m10x/Makefile.inc | 5 +++ src/superio/smsc/lpc47m10x/early_serial.c | 36 ++++++++++++++++++ src/superio/smsc/lpc47m10x/lpc47m10x.h | 25 ++++++++++++ src/superio/smsc/lpc47m10x/superio.c | 63 +++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 src/superio/smsc/lpc47m10x/Kconfig create mode 100644 src/superio/smsc/lpc47m10x/Makefile.inc create mode 100644 src/superio/smsc/lpc47m10x/early_serial.c create mode 100644 src/superio/smsc/lpc47m10x/lpc47m10x.h create mode 100644 src/superio/smsc/lpc47m10x/superio.c (limited to 'src/superio/smsc/lpc47m10x') diff --git a/src/superio/smsc/lpc47m10x/Kconfig b/src/superio/smsc/lpc47m10x/Kconfig new file mode 100644 index 0000000000..9d6b9481b1 --- /dev/null +++ b/src/superio/smsc/lpc47m10x/Kconfig @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SUPERIO_SMSC_LPC47M10X + bool diff --git a/src/superio/smsc/lpc47m10x/Makefile.inc b/src/superio/smsc/lpc47m10x/Makefile.inc new file mode 100644 index 0000000000..d0d4cbc28c --- /dev/null +++ b/src/superio/smsc/lpc47m10x/Makefile.inc @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +bootblock-$(CONFIG_SUPERIO_SMSC_LPC47M10X) += early_serial.c +romstage-$(CONFIG_SUPERIO_SMSC_LPC47M10X) += early_serial.c +ramstage-$(CONFIG_SUPERIO_SMSC_LPC47M10X) += superio.c diff --git a/src/superio/smsc/lpc47m10x/early_serial.c b/src/superio/smsc/lpc47m10x/early_serial.c new file mode 100644 index 0000000000..38a13f56a7 --- /dev/null +++ b/src/superio/smsc/lpc47m10x/early_serial.c @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include "lpc47m10x.h" + +void pnp_enter_conf_state(pnp_devfn_t dev) +{ + u16 port = dev >> 8; + outb(0x55, port); +} + +void pnp_exit_conf_state(pnp_devfn_t dev) +{ + u16 port = dev >> 8; + outb(0xaa, port); +} + +/** + * Configure the base I/O port of the specified serial device and enable the + * serial device. + * + * @param dev High 8 bits = Super I/O port, low 8 bits = logical device number. + * @param iobase Processor I/O port address to assign to this serial device. + */ +void lpc47m10x_enable_serial(pnp_devfn_t dev, u16 iobase) +{ + pnp_enter_conf_state(dev); + pnp_set_logical_device(dev); + pnp_set_enable(dev, 0); + pnp_set_iobase(dev, PNP_IDX_IO0, iobase); + pnp_set_enable(dev, 1); + pnp_exit_conf_state(dev); +} diff --git a/src/superio/smsc/lpc47m10x/lpc47m10x.h b/src/superio/smsc/lpc47m10x/lpc47m10x.h new file mode 100644 index 0000000000..b8bd3a0246 --- /dev/null +++ b/src/superio/smsc/lpc47m10x/lpc47m10x.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef SUPERIO_SMSC_LPC47M10X_H +#define SUPERIO_SMSC_LPC47M10X_H + +#include +#include + +#define LPC47M10X2_FDC 0 /* Floppy */ +#define LPC47M10X2_PP 3 /* Parallel Port */ +#define LPC47M10X2_SP1 4 /* Com1 */ +#define LPC47M10X2_SP2 5 /* Com2 */ +#define LPC47M10X2_KBC 7 /* Keyboard & Mouse */ +#define LPC47M10X2_GAME 9 /* GAME */ +#define LPC47M10X2_PME 10 /* PME reg*/ +#define LPC47M10X2_MPU 11 /* MPU-401 MIDI */ + +#define LPC47M10X2_MAX_CONFIG_REGISTER 0x5F + +void lpc47m10x_enable_serial(pnp_devfn_t dev, u16 iobase); + +void pnp_enter_conf_state(pnp_devfn_t dev); +void pnp_exit_conf_state(pnp_devfn_t dev); + +#endif /* SUPERIO_SMSC_LPC47M10X_H */ diff --git a/src/superio/smsc/lpc47m10x/superio.c b/src/superio/smsc/lpc47m10x/superio.c new file mode 100644 index 0000000000..cb297a5b14 --- /dev/null +++ b/src/superio/smsc/lpc47m10x/superio.c @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +#include "lpc47m10x.h" + +/** + * Initialize the specified Super I/O device. + * + * Devices other than COM ports and the keyboard controller are ignored. + * For COM ports, we configure the baud rate. + * + * @param dev Pointer to structure describing a Super I/O device. + */ +static void lpc47m10x_init(struct device *dev) +{ + if (!dev->enabled) + return; + + switch (dev->path.pnp.device) { + case LPC47M10X2_KBC: + pc_keyboard_init(NO_AUX_DEVICE); + break; + } +} + +static struct device_operations ops = { + .read_resources = pnp_read_resources, + .set_resources = pnp_set_resources, + .enable_resources = pnp_enable_resources, + .enable = pnp_alt_enable, + .init = lpc47m10x_init, + .ops_pnp_mode = &pnp_conf_mode_55_aa, +}; + +static struct pnp_info pnp_dev_info[] = { + { NULL, LPC47M10X2_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, + { NULL, LPC47M10X2_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, + { NULL, LPC47M10X2_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, + { NULL, LPC47M10X2_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, }, + { NULL, LPC47M10X2_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, + 0x07ff, 0x07ff, }, + { NULL, LPC47M10X2_PME, PNP_IO0, 0x0f80, }, +}; + +/** + * Create device structures and allocate resources to devices specified in the + * pnp_dev_info array (above). + * + * @param dev Pointer to structure describing a Super I/O device. + */ +static void enable_dev(struct device *dev) +{ + pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); +} + +struct chip_operations superio_smsc_lpc47m10x_ops = { + CHIP_NAME("SMSC LPC47M10x Super I/O") + .enable_dev = enable_dev +}; -- cgit v1.2.3