payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / roda / rk9 / bootblock.c
blob4c8713d14d127826598d581893a8b5937f71addc
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootblock_common.h>
4 #include <arch/io.h>
5 #include <device/pnp_ops.h>
6 #include <superio/smsc/lpc47n227/lpc47n227.h>
8 #define SERIAL_DEV PNP_DEV(0x2e, LPC47N227_SP1)
10 void bootblock_mainboard_early_init(void)
12 /* Original settings:
13 idx 30 31 32 33 34 35 36 37 38 39
14 val 60 00 00 40 00 ff 00 e0 00 80
15 def 00 00 00 00 00 00 00 00 00 80
17 Values:
18 GP1 GP2 GP3 GP4
19 fd 17 88 14
21 const pnp_devfn_t sio = PNP_DEV(0x2e, 0);
23 /* Enter super-io's configuration state. */
24 pnp_enter_conf_state(sio);
26 /* Set lpc47n227's runtime register block's base address. */
27 pnp_write_config(sio, 0x30, 0x600 >> 4);
29 /* Set GP23 to alternate function. */
30 pnp_write_config(sio, 0x33, 0x40);
32 /* Set GP30 - GP37 to output mode: COM control */
33 pnp_write_config(sio, 0x35, 0xff);
35 /* Set GP45 - GP47 to output mode. */
36 pnp_write_config(sio, 0x37, 0xe0);
38 /* Set nIO_PME to open drain. */
39 pnp_write_config(sio, 0x39, 0x80);
41 /* Exit configuration state. */
42 pnp_exit_conf_state(sio);
44 /* Set GPIO output values: */
45 outb(0x88, 0x600 + 0xb + 3); /* GP30 - GP37 */
46 outb(0x10, 0x600 + 0xb + 4); /* GP40 - GP47 */
48 lpc47n227_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);