Rename src/superio/NSC to src/superio/nsc.
[coreboot.git] / src / superio / nsc / pc97317 / pc97317_early_serial.c
1 #include <arch/romcc_io.h>
2 #include "pc97317.h"
3
4 #define PM_DEV PNP_DEV(0x2e, PC97317_PM)
5 #define PM_BASE 0xe8
6
7 /* The pc97317 needs clocks to be set up before the serial port will operate */
8
9 static void pc97317_enable_serial(device_t dev, unsigned iobase)
10 {
11         /* Set base address of power management unit */
12
13         pnp_set_logical_device(PM_DEV);
14         pnp_set_enable(dev, 0);
15         pnp_set_iobase(dev, PNP_IDX_IO0, PM_BASE);
16         pnp_set_enable(dev, 1);
17
18         /* Use on-chip clock multiplier */
19
20         outb(0x03, PM_BASE);
21         outb(inb(PM_BASE + 1) | 0x07, PM_BASE + 1);
22         
23         /* Wait for the clock to stabilise */
24         while(!inb(PM_BASE + 1 & 0x80))
25                 ;
26
27         /* Set the base address of the port */
28
29         pnp_set_logical_device(dev);
30         pnp_set_enable(dev, 0);
31         pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
32         pnp_set_enable(dev, 1);
33 }