summaryrefslogtreecommitdiff
path: root/src/superio/nsc
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2010-11-15 19:35:14 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2010-11-15 19:35:14 +0000
commita69d978be8a068944466e776de87527fb104a878 (patch)
tree8acf4247e3104ad9ccb940568a81e472105a674b /src/superio/nsc
parent2e9323e5bef293c051d9fd982214e6db2e3305ee (diff)
downloadcoreboot-a69d978be8a068944466e776de87527fb104a878.tar.xz
C and other Super I/O cosmetic fixes.
- Random coding style, whitespace and cosmetic fixes. - Consistently use the same spacing and 4-hexdigit port number format in the pnp_dev_info[] arrays. - Drop dead/unused code and less useful comments. - Add missing "(C)" characters and copyright years. - Shorten and simplify some code snippets. - Use u8/u16/etc. everywhere. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6073 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/superio/nsc')
-rw-r--r--src/superio/nsc/pc8374/Makefile.inc2
-rw-r--r--src/superio/nsc/pc8374/pc8374_early_init.c23
-rw-r--r--src/superio/nsc/pc8374/superio.c30
-rw-r--r--src/superio/nsc/pc87309/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87309/pc87309_early_serial.c2
-rw-r--r--src/superio/nsc/pc87309/superio.c27
-rw-r--r--src/superio/nsc/pc87351/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87351/pc87351_early_serial.c2
-rw-r--r--src/superio/nsc/pc87351/superio.c35
-rw-r--r--src/superio/nsc/pc87360/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87360/pc87360_early_serial.c2
-rw-r--r--src/superio/nsc/pc87360/superio.c36
-rw-r--r--src/superio/nsc/pc87366/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87366/pc87366_early_serial.c2
-rw-r--r--src/superio/nsc/pc87366/superio.c33
-rw-r--r--src/superio/nsc/pc87417/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87417/pc87417.h4
-rw-r--r--src/superio/nsc/pc87417/pc87417_early_init.c21
-rw-r--r--src/superio/nsc/pc87417/pc87417_early_serial.c4
-rw-r--r--src/superio/nsc/pc87417/superio.c33
-rw-r--r--src/superio/nsc/pc87427/Makefile.inc2
-rw-r--r--src/superio/nsc/pc87427/pc87427_early_init.c22
-rw-r--r--src/superio/nsc/pc87427/superio.c39
-rw-r--r--src/superio/nsc/pc97307/Makefile.inc2
-rw-r--r--src/superio/nsc/pc97307/superio.c53
-rw-r--r--src/superio/nsc/pc97317/Makefile.inc2
-rw-r--r--src/superio/nsc/pc97317/pc97317_early_serial.c16
-rw-r--r--src/superio/nsc/pc97317/superio.c52
28 files changed, 197 insertions, 257 deletions
diff --git a/src/superio/nsc/pc8374/Makefile.inc b/src/superio/nsc/pc8374/Makefile.inc
index 9d88cf6761..5de252b6a9 100644
--- a/src/superio/nsc/pc8374/Makefile.inc
+++ b/src/superio/nsc/pc8374/Makefile.inc
@@ -19,5 +19,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC8374) += superio.c
+
diff --git a/src/superio/nsc/pc8374/pc8374_early_init.c b/src/superio/nsc/pc8374/pc8374_early_init.c
index ac73b26602..29b57e43a9 100644
--- a/src/superio/nsc/pc8374/pc8374_early_init.c
+++ b/src/superio/nsc/pc8374/pc8374_early_init.c
@@ -22,30 +22,31 @@
#include <arch/romcc_io.h>
#include "pc8374.h"
-/* things that Must Be Done to get this chip working */
-/* Straight from the data book */
-static void pc8374_enable(unsigned iobase, u8 *init)
+static void pc8374_enable(u16 iobase, u8 *init)
{
u8 val, count;
+
outb(0x29, iobase);
- val = inb(iobase+1);
+ val = inb(iobase + 1);
val |= 0x91;
- outb(val, iobase+1);
- for(count = 0; count < 255; count++)
- if (inb(iobase+1) == 0x91)
+ outb(val, iobase + 1);
+
+ for (count = 0; count < 255; count++)
+ if (inb(iobase + 1) == 0x91)
break;
- for(;*init; init++) {
+
+ for (; *init; init++) {
outb(*init, iobase);
- val = inb(iobase+1);
+ val = inb(iobase + 1);
init++;
val &= *init;
init++;
val |= *init;
- outb(val, iobase+1);
+ outb(val, iobase + 1);
}
}
-static void pc8374_enable_dev(device_t dev, unsigned iobase)
+static void pc8374_enable_dev(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc8374/superio.c b/src/superio/nsc/pc8374/superio.c
index 189c2d1dbf..247aae913e 100644
--- a/src/superio/nsc/pc8374/superio.c
+++ b/src/superio/nsc/pc8374/superio.c
@@ -33,15 +33,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc8374_config *conf;
+ struct superio_nsc_pc8374_config *conf = dev­>chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC8374_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -66,20 +63,19 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC8374_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC8374_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
- { &ops, PC8374_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
- { &ops, PC8374_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC8374_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
- { &ops, PC8374_KBCM, PNP_IRQ0 },
- { &ops, PC8374_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC8374_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
+ { &ops, PC8374_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC8374_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC8374_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC8374_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC8374_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC8374_KBCM, PNP_IRQ0, },
+ { &ops, PC8374_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC8374_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
};
static void enable_dev(struct device *dev)
{
- pnp_enable_devices(dev, &ops,
- ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_nsc_pc8374_ops = {
diff --git a/src/superio/nsc/pc87309/Makefile.inc b/src/superio/nsc/pc87309/Makefile.inc
index 87104f9daf..3db0493960 100644
--- a/src/superio/nsc/pc87309/Makefile.inc
+++ b/src/superio/nsc/pc87309/Makefile.inc
@@ -18,5 +18,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87309) += superio.c
+
diff --git a/src/superio/nsc/pc87309/pc87309_early_serial.c b/src/superio/nsc/pc87309/pc87309_early_serial.c
index 8e16fddafd..14c755d365 100644
--- a/src/superio/nsc/pc87309/pc87309_early_serial.c
+++ b/src/superio/nsc/pc87309/pc87309_early_serial.c
@@ -21,7 +21,7 @@
#include <arch/romcc_io.h>
#include "pc87309.h"
-static void pc87309_enable_serial(device_t dev, unsigned int iobase)
+static void pc87309_enable_serial(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc87309/superio.c b/src/superio/nsc/pc87309/superio.c
index 04f75fbaa9..e3f7b7b0fe 100644
--- a/src/superio/nsc/pc87309/superio.c
+++ b/src/superio/nsc/pc87309/superio.c
@@ -29,13 +29,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87309_config *conf;
+ struct superio_nsc_pc87309_config *conf = dev->chip_info;
struct resource *res0;
- if (!dev->enabled) {
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch (dev->path.pnp.device) {
case PC87309_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -52,21 +51,21 @@ static void init(device_t dev)
}
static struct device_operations ops = {
- .read_resources = pnp_read_resources,
- .set_resources = pnp_set_resources,
+ .read_resources = pnp_read_resources,
+ .set_resources = pnp_set_resources,
.enable_resources = pnp_enable_resources,
- .enable = pnp_enable,
- .init = init,
+ .enable = pnp_enable,
+ .init = init,
};
static struct pnp_info pnp_dev_info[] = {
- {&ops, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0},},
- {&ops, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0},},
- {&ops, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x7f8, 0},},
- {&ops, PC87309_SP1, PNP_IO0 | PNP_IRQ0, {0x7f8, 0},},
+ { &ops, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC87309_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
/* TODO: PM. */
- {&ops, PC87309_KBCM, PNP_IRQ0},
- {&ops, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x7f8, 0}, {0x7f8, 0x4},},
+ { &ops, PC87309_KBCM, PNP_IRQ0, },
+ { &ops, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x7f8, 4}, },
};
static void enable_dev(struct device *dev)
diff --git a/src/superio/nsc/pc87351/Makefile.inc b/src/superio/nsc/pc87351/Makefile.inc
index c1809b1b57..8e0a0c3aea 100644
--- a/src/superio/nsc/pc87351/Makefile.inc
+++ b/src/superio/nsc/pc87351/Makefile.inc
@@ -19,5 +19,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87351) += superio.c
+
diff --git a/src/superio/nsc/pc87351/pc87351_early_serial.c b/src/superio/nsc/pc87351/pc87351_early_serial.c
index 2072d4f072..ef55e37d78 100644
--- a/src/superio/nsc/pc87351/pc87351_early_serial.c
+++ b/src/superio/nsc/pc87351/pc87351_early_serial.c
@@ -22,7 +22,7 @@
#include <arch/romcc_io.h>
#include "pc87351.h"
-static void pc87351_enable_serial(device_t dev, unsigned iobase)
+static void pc87351_enable_serial(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc87351/superio.c b/src/superio/nsc/pc87351/superio.c
index 83f10b93f7..aa8c6fdae0 100644
--- a/src/superio/nsc/pc87351/superio.c
+++ b/src/superio/nsc/pc87351/superio.c
@@ -19,12 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- * Richard A Smith
- * I derived this code from the pc87360 device and removed the stuff the 87351
- * dosen't do.
- */
-
#include <arch/io.h>
#include <device/device.h>
#include <device/pnp.h>
@@ -39,15 +33,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87351_config *conf;
+ struct superio_nsc_pc87351_config *conf = dev->chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC87351_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -72,15 +63,15 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC87351_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC87351_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
- { &ops, PC87351_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
- { &ops, PC87351_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87351_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
- { &ops, PC87351_KBCM, PNP_IRQ0 },
- { &ops, PC87351_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC87351_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87351_FSD, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
+ { &ops, PC87351_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87351_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC87351_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC87351_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87351_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC87351_KBCM, PNP_IRQ0, },
+ { &ops, PC87351_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC87351_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87351_FSD, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
};
static void enable_dev(struct device *dev)
diff --git a/src/superio/nsc/pc87360/Makefile.inc b/src/superio/nsc/pc87360/Makefile.inc
index 142b00c51a..df2e3bfe2f 100644
--- a/src/superio/nsc/pc87360/Makefile.inc
+++ b/src/superio/nsc/pc87360/Makefile.inc
@@ -19,5 +19,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87360) += superio.c
+
diff --git a/src/superio/nsc/pc87360/pc87360_early_serial.c b/src/superio/nsc/pc87360/pc87360_early_serial.c
index 7cfa4981f4..6c468129a7 100644
--- a/src/superio/nsc/pc87360/pc87360_early_serial.c
+++ b/src/superio/nsc/pc87360/pc87360_early_serial.c
@@ -22,7 +22,7 @@
#include <arch/romcc_io.h>
#include "pc87360.h"
-static void pc87360_enable_serial(device_t dev, unsigned iobase)
+static void pc87360_enable_serial(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc87360/superio.c b/src/superio/nsc/pc87360/superio.c
index d85d10a648..b6cd729e81 100644
--- a/src/superio/nsc/pc87360/superio.c
+++ b/src/superio/nsc/pc87360/superio.c
@@ -33,15 +33,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87360_config *conf;
+ struct superio_nsc_pc87360_config *conf = dev->chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC87360_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -66,23 +63,22 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC87360_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC87360_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
- { &ops, PC87360_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
- { &ops, PC87360_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87360_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
- { &ops, PC87360_KBCM, PNP_IRQ0 },
- { &ops, PC87360_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC87360_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87360_ACB, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87360_FSCM, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87360_WDT, PNP_IO0 | PNP_IRQ0, { 0xfffc, 0 } },
+ { &ops, PC87360_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87360_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC87360_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC87360_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87360_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC87360_KBCM, PNP_IRQ0, },
+ { &ops, PC87360_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC87360_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87360_ACB, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87360_FSCM, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87360_WDT, PNP_IO0 | PNP_IRQ0, {0xfffc, 0}, },
};
static void enable_dev(struct device *dev)
{
- pnp_enable_devices(dev, &ops,
- ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_nsc_pc87360_ops = {
diff --git a/src/superio/nsc/pc87366/Makefile.inc b/src/superio/nsc/pc87366/Makefile.inc
index 9ce1e17f7e..83bfec1b11 100644
--- a/src/superio/nsc/pc87366/Makefile.inc
+++ b/src/superio/nsc/pc87366/Makefile.inc
@@ -19,5 +19,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87366) += superio.c
+
diff --git a/src/superio/nsc/pc87366/pc87366_early_serial.c b/src/superio/nsc/pc87366/pc87366_early_serial.c
index f50bb091cb..4620d228b0 100644
--- a/src/superio/nsc/pc87366/pc87366_early_serial.c
+++ b/src/superio/nsc/pc87366/pc87366_early_serial.c
@@ -22,7 +22,7 @@
#include <arch/romcc_io.h>
#include "pc87366.h"
-static void pc87366_enable_serial(device_t dev, unsigned iobase)
+static void pc87366_enable_serial(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc87366/superio.c b/src/superio/nsc/pc87366/superio.c
index a38f386d60..af8f8993a2 100644
--- a/src/superio/nsc/pc87366/superio.c
+++ b/src/superio/nsc/pc87366/superio.c
@@ -33,15 +33,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87366_config *conf;
+ struct superio_nsc_pc87366_config *conf = dev->chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC87366_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -66,17 +63,17 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC87366_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC87366_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
- { &ops, PC87366_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
- { &ops, PC87366_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87366_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
- { &ops, PC87366_KBCM, PNP_IRQ0 },
- { &ops, PC87366_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC87366_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87366_ACB, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87366_FSCM, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87366_WDT, PNP_IO0 | PNP_IRQ0, { 0xfffc, 0 } },
+ { &ops, PC87366_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87366_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC87366_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC87366_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87366_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC87366_KBCM, PNP_IRQ0, },
+ { &ops, PC87366_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC87366_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87366_ACB, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87366_FSCM, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87366_WDT, PNP_IO0 | PNP_IRQ0, {0xfffc, 0}, },
};
static void enable_dev(struct device *dev)
diff --git a/src/superio/nsc/pc87417/Makefile.inc b/src/superio/nsc/pc87417/Makefile.inc
index d1236155ff..3da2f1720d 100644
--- a/src/superio/nsc/pc87417/Makefile.inc
+++ b/src/superio/nsc/pc87417/Makefile.inc
@@ -20,5 +20,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87417) += superio.c
+
diff --git a/src/superio/nsc/pc87417/pc87417.h b/src/superio/nsc/pc87417/pc87417.h
index c2051f6a75..e24084cafa 100644
--- a/src/superio/nsc/pc87417/pc87417.h
+++ b/src/superio/nsc/pc87417/pc87417.h
@@ -3,7 +3,7 @@
*
* Copyright (C) 2000 AG Electronics Ltd.
* Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan by yhlu
+ * Copyright (C) 2004 Tyan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -115,7 +115,7 @@
#define PC87417_XWBCNF 0x16
#if defined(__PRE_RAM__) && !defined(__ROMCC__)
-void pc87417_enable_serial(device_t dev, unsigned iobase);
+void pc87417_enable_serial(device_t dev, u16 iobase);
void pc87417_enable_dev(device_t dev);
#endif
diff --git a/src/superio/nsc/pc87417/pc87417_early_init.c b/src/superio/nsc/pc87417/pc87417_early_init.c
index c9332eedbe..a635beb61d 100644
--- a/src/superio/nsc/pc87417/pc87417_early_init.c
+++ b/src/superio/nsc/pc87417/pc87417_early_init.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2000 AG Electronics Ltd.
* Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan by yhlu
+ * Copyright (C) 2004 Tyan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ static void pc87417_disable_dev(device_t dev)
pnp_set_enable(dev, 0);
}
-static void pc87417_enable_dev(device_t dev, unsigned iobase)
+static void pc87417_enable_dev(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
@@ -39,17 +39,16 @@ static void pc87417_enable_dev(device_t dev, unsigned iobase)
static void xbus_cfg(device_t dev)
{
- uint8_t i, data;
- uint16_t xbus_index;
+ u8 i, data;
+ u16 xbus_index;
pnp_set_logical_device(dev);
- /* select proper BIOS size (4MB) */
- pnp_write_config(dev, PC87417_XMEMCNF2, (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04);
+ /* Select proper BIOS size (4MB). */
+ pnp_write_config(dev, PC87417_XMEMCNF2,
+ (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04);
xbus_index = pnp_read_iobase(dev, 0x60);
- /* enable writes to devices attached to XCS0 (XBUS Chip Select 0) */
- for (i=0; i<= 0xf; i++) {
- outb((i<<4), xbus_index + PC87417_HAP0);
- }
- return;
+ /* Enable writes to devices attached to XCS0 (XBUS Chip Select 0). */
+ for (i = 0; i <= 0xf; i++)
+ outb((i << 4), xbus_index + PC87417_HAP0);
}
diff --git a/src/superio/nsc/pc87417/pc87417_early_serial.c b/src/superio/nsc/pc87417/pc87417_early_serial.c
index 8d748046c6..c30d9487a8 100644
--- a/src/superio/nsc/pc87417/pc87417_early_serial.c
+++ b/src/superio/nsc/pc87417/pc87417_early_serial.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2000 AG Electronics Ltd.
* Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan by yhlu
+ * Copyright (C) 2004 Tyan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
#include <arch/romcc_io.h>
#include "pc87417.h"
-void pc87417_enable_serial(device_t dev, unsigned iobase)
+void pc87417_enable_serial(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
diff --git a/src/superio/nsc/pc87417/superio.c b/src/superio/nsc/pc87417/superio.c
index 1eee9595bf..fede61e6bd 100644
--- a/src/superio/nsc/pc87417/superio.c
+++ b/src/superio/nsc/pc87417/superio.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2000 AG Electronics Ltd.
* Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan by yhlu
+ * Copyright (C) 2004 Tyan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,15 +34,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87417_config *conf;
+ struct superio_nsc_pc87417_config *conf = dev->chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC87417_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -67,16 +64,16 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
- { &ops, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
- { &ops, PC87417_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87417_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
- { &ops, PC87417_KBCM, PNP_IRQ0 },
- { &ops, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
- { &ops, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, { 0xffe0, 0 } },
- { &ops, PC87417_RTC, PNP_IO0 | PNP_IO1, { 0xfffe, 0 }, {0xfffe, 0x4} },
+ { &ops, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
+ { &ops, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
+ { &ops, PC87417_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87417_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC87417_KBCM, PNP_IRQ0, },
+ { &ops, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, {0xffe0, 0}, },
+ { &ops, PC87417_RTC, PNP_IO0 | PNP_IO1, {0xfffe, 0}, {0xfffe, 4}, },
};
static void enable_dev(struct device *dev)
diff --git a/src/superio/nsc/pc87427/Makefile.inc b/src/superio/nsc/pc87427/Makefile.inc
index 9b03a255b1..4c104d3dd0 100644
--- a/src/superio/nsc/pc87427/Makefile.inc
+++ b/src/superio/nsc/pc87427/Makefile.inc
@@ -19,5 +19,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC87427) += superio.c
+
diff --git a/src/superio/nsc/pc87427/pc87427_early_init.c b/src/superio/nsc/pc87427/pc87427_early_init.c
index bbb140d57c..8c1f47d161 100644
--- a/src/superio/nsc/pc87427/pc87427_early_init.c
+++ b/src/superio/nsc/pc87427/pc87427_early_init.c
@@ -27,26 +27,28 @@ static void pc87427_disable_dev(device_t dev)
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
}
-static void pc87427_enable_dev(device_t dev, unsigned iobase)
+
+static void pc87427_enable_dev(device_t dev, u16 iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
pnp_set_enable(dev, 1);
}
+
static void xbus_cfg(device_t dev)
{
- uint8_t i, data;
- uint16_t xbus_index;
+ u8 i, data;
+ u16 xbus_index;
pnp_set_logical_device(dev);
- /* select proper BIOS size (4MB) */
- pnp_write_config(dev, PC87427_XMEMCNF2, (pnp_read_config(dev, PC87427_XMEMCNF2)) | 0x04);
+
+ /* Select proper BIOS size (4MB). */
+ pnp_write_config(dev, PC87427_XMEMCNF2,
+ (pnp_read_config(dev, PC87427_XMEMCNF2)) | 0x04);
xbus_index = pnp_read_iobase(dev, 0x60);
- /* enable writes to devices attached to XCS0 (XBUS Chip Select 0) */
- for (i=0; i<= 0xf; i++) {
- outb((i<<4), xbus_index + PC87427_HAP0);
- }
- return;
+ /* Enable writes to devices attached to XCS0 (XBUS Chip Select 0). */
+ for (i = 0; i <= 0xf; i++)
+ outb((i << 4), xbus_index + PC87427_HAP0);
}
diff --git a/src/superio/nsc/pc87427/superio.c b/src/superio/nsc/pc87427/superio.c
index 82efb3c4ee..088fd0aa6f 100644
--- a/src/superio/nsc/pc87427/superio.c
+++ b/src/superio/nsc/pc87427/superio.c
@@ -31,15 +31,12 @@
static void init(device_t dev)
{
- struct superio_nsc_pc87427_config *conf;
+ struct superio_nsc_pc87427_config *conf = dev->chip_info;
struct resource *res0;
- /* Wishlist handle well known programming interfaces more
- * generically.
- */
- if (!dev->enabled) {
+
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC87427_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -64,25 +61,23 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC87427_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
- { &ops, PC87427_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87427_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, PC87427_SWC, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IO3 | PNP_IRQ0,
- { 0xfff0, 0 }, { 0xfffc, 0 }, { 0xfffc, 0 }, { 0xfff8, 0 } },
- { &ops, PC87427_KBCM, PNP_IRQ0 },
- { &ops, PC87427_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
- { &ops, PC87427_GPIO, PNP_IO0 | PNP_IRQ0, { 0xffe0, 0 } },
- { &ops, PC87427_WDT, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 } },
- { &ops, PC87427_FMC, PNP_IO0 | PNP_IRQ0, { 0xffe0, 0 } },
- { &ops, PC87427_XBUS, PNP_IO0 | PNP_IRQ0, { 0xffe0, 0 } },
- { &ops, PC87427_RTC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xfffe, 0 }, { 0xfffe, 0 } },
- { &ops, PC87427_MHC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xffe0, 0 }, { 0xffe0, 0 } },
+ { &ops, PC87427_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
+ { &ops, PC87427_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87427_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, PC87427_SWC, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IO3 | PNP_IRQ0, {0xfff0, 0}, {0xfffc, 0}, {0xfffc, 0}, {0xfff8, 0}, },
+ { &ops, PC87427_KBCM, PNP_IRQ0, },
+ { &ops, PC87427_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
+ { &ops, PC87427_GPIO, PNP_IO0 | PNP_IRQ0, {0xffe0, 0}, },
+ { &ops, PC87427_WDT, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
+ { &ops, PC87427_FMC, PNP_IO0 | PNP_IRQ0, {0xffe0, 0}, },
+ { &ops, PC87427_XBUS, PNP_IO0 | PNP_IRQ0, {0xffe0, 0}, },
+ { &ops, PC87427_RTC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0xfffe, 0}, {0xfffe, 0}, },
+ { &ops, PC87427_MHC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0xffe0, 0}, {0xffe0, 0}, },
};
static void enable_dev(struct device *dev)
{
- pnp_enable_devices(dev, &ops,
- ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_nsc_pc87427_ops = {
diff --git a/src/superio/nsc/pc97307/Makefile.inc b/src/superio/nsc/pc97307/Makefile.inc
index 67295a219f..874353292e 100644
--- a/src/superio/nsc/pc97307/Makefile.inc
+++ b/src/superio/nsc/pc97307/Makefile.inc
@@ -18,5 +18,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC97307) += superio.c
+
diff --git a/src/superio/nsc/pc97307/superio.c b/src/superio/nsc/pc97307/superio.c
index bd14919eca..b8ae944153 100644
--- a/src/superio/nsc/pc97307/superio.c
+++ b/src/superio/nsc/pc97307/superio.c
@@ -28,45 +28,37 @@
static void init(device_t dev)
{
- struct superio_nsc_pc97307_config *conf;
+ struct superio_nsc_pc97307_config *conf = dev->chip_info;
struct resource *res0;
+ u8 reg8;
- if (!dev->enabled) {
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC97307_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
init_uart8250(res0->base, &conf->com1);
break;
-
case PC97307_SP2:
res0 = find_resource(dev, PNP_IDX_IO0);
init_uart8250(res0->base, &conf->com2);
break;
-
case PC97307_KBCK:
- /* Enable keyboard */
pnp_set_logical_device(dev);
- pnp_set_enable(dev, 0); /* Disable keyboard */
- pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 Mhz */
- pnp_set_enable(dev, 1); /* Enable keyboard */
-
+ pnp_set_enable(dev, 0); /* Disable keyboard */
+ pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 MHz. */
+ pnp_set_enable(dev, 1); /* Enable keyboard. */
pc_keyboard_init(&conf->keyboard);
break;
-
case PC97307_FDC:
- {
- unsigned reg;
- /* Set up floppy in PS/2 mode */
+ /* Set up floppy in PS/2 mode. */
outb(0x09, SIO_CONFIG_RA);
- reg = inb(SIO_CONFIG_RD);
- reg = (reg & 0x3F) | 0x40;
- outb(reg, SIO_CONFIG_RD);
- outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
+ reg8 = inb(SIO_CONFIG_RD);
+ reg8 = (reg8 & 0x3F) | 0x40;
+ outb(reg8, SIO_CONFIG_RD);
+ outb(reg8, SIO_CONFIG_RD); /* Have to write twice to change! */
break;
- }
default:
break;
}
@@ -81,21 +73,20 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC97307_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xffb, 0 }, { 0xffb, 0x4}, },
- { &ops, PC97307_KBCM, PNP_IRQ0 },
- { &ops, PC97307_RTC, PNP_IO0 | PNP_IRQ0, { 0xfffe, 0}, },
- { &ops, PC97307_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0xfffa, 0}, },
- { &ops, PC97307_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x03fc, 0}, },
- { &ops, PC97307_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0xfff8, 0 }, },
- { &ops, PC97307_SP1, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 }, },
- { &ops, PC97307_GPIO, PNP_IO0, { 0xfff8, 0 } },
- { &ops, PC97307_PM, PNP_IO0, { 0xfffe, 0 } },
+ { &ops, PC97307_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0ffb, 0}, {0x0ffb, 4}, },
+ { &ops, PC97307_KBCM, PNP_IRQ0, },
+ { &ops, PC97307_RTC, PNP_IO0 | PNP_IRQ0, {0xfffe, 0}, },
+ { &ops, PC97307_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0xfffa, 0}, },
+ { &ops, PC97307_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x03fc, 0}, },
+ { &ops, PC97307_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0xfff8, 0}, },
+ { &ops, PC97307_SP1, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC97307_GPIO, PNP_IO0, {0xfff8, 0}, },
+ { &ops, PC97307_PM, PNP_IO0, {0xfffe, 0}, },
};
static void enable_dev(struct device *dev)
{
- pnp_enable_devices(dev, &ops,
- ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_nsc_pc97307_ops = {
diff --git a/src/superio/nsc/pc97317/Makefile.inc b/src/superio/nsc/pc97317/Makefile.inc
index 6afa133075..129688d044 100644
--- a/src/superio/nsc/pc97317/Makefile.inc
+++ b/src/superio/nsc/pc97317/Makefile.inc
@@ -18,5 +18,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-#config chip.h
ramstage-$(CONFIG_SUPERIO_NSC_PC97317) += superio.c
+
diff --git a/src/superio/nsc/pc97317/pc97317_early_serial.c b/src/superio/nsc/pc97317/pc97317_early_serial.c
index 175d490f1b..00a92b3be6 100644
--- a/src/superio/nsc/pc97317/pc97317_early_serial.c
+++ b/src/superio/nsc/pc97317/pc97317_early_serial.c
@@ -24,28 +24,24 @@
#define PM_DEV PNP_DEV(0x2e, PC97317_PM)
#define PM_BASE 0xe8
-/* The pc97317 needs clocks to be set up before the serial port will operate */
-
-static void pc97317_enable_serial(device_t dev, unsigned iobase)
+/* The PC97317 needs clocks to be set up before the serial port will operate. */
+static void pc97317_enable_serial(device_t dev, u16 iobase)
{
- /* Set base address of power management unit */
-
+ /* Set base address of power management unit. */
pnp_set_logical_device(PM_DEV);
pnp_set_enable(dev, 0);
pnp_set_iobase(dev, PNP_IDX_IO0, PM_BASE);
pnp_set_enable(dev, 1);
- /* Use on-chip clock multiplier */
-
+ /* Use on-chip clock multiplier. */
outb(0x03, PM_BASE);
outb(inb(PM_BASE + 1) | 0x07, PM_BASE + 1);
- /* Wait for the clock to stabilise */
+ /* Wait for the clock to stabilise. */
while(!(inb(PM_BASE + 1) & 0x80))
;
- /* Set the base address of the port */
-
+ /* Set the base address of the port. */
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
diff --git a/src/superio/nsc/pc97317/superio.c b/src/superio/nsc/pc97317/superio.c
index 2dced41898..5d7824f117 100644
--- a/src/superio/nsc/pc97317/superio.c
+++ b/src/superio/nsc/pc97317/superio.c
@@ -28,47 +28,28 @@
static void init(device_t dev)
{
- struct superio_nsc_pc97317_config *conf;
+ struct superio_nsc_pc97317_config *conf = dev->chip_info;
struct resource *res0;
- if (!dev->enabled) {
+ if (!dev->enabled)
return;
- }
- conf = dev->chip_info;
+
switch(dev->path.pnp.device) {
case PC97317_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
init_uart8250(res0->base, &conf->com1);
break;
-
case PC97317_SP2:
res0 = find_resource(dev, PNP_IDX_IO0);
init_uart8250(res0->base, &conf->com2);
break;
-
case PC97317_KBCK:
- /* Enable keyboard */
pnp_set_logical_device(dev);
- pnp_set_enable(dev, 0); /* Disable keyboard */
- pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 Mhz */
- pnp_set_enable(dev, 1); /* Enable keyboard */
-
+ pnp_set_enable(dev, 0); /* Disable keyboard */
+ pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 MHz. */
+ pnp_set_enable(dev, 1); /* Enable keyboard */
pc_keyboard_init(&conf->keyboard);
break;
-
-#if 0
- case PC97317_FDC:
- {
- unsigned reg;
- /* Set up floppy in PS/2 mode */
- outb(0x09, SIO_CONFIG_RA);
- reg = inb(SIO_CONFIG_RD);
- reg = (reg & 0x3F) | 0x40;
- outb(reg, SIO_CONFIG_RD);
- outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
- break;
- }
-#endif
default:
break;
}
@@ -83,21 +64,20 @@ static struct device_operations ops = {
};
static struct pnp_info pnp_dev_info[] = {
- { &ops, PC97317_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xffb, 0 }, { 0xffb, 0x4}, },
- { &ops, PC97317_KBCM, PNP_IRQ0 },
- { &ops, PC97317_RTC, PNP_IO0 | PNP_IRQ0, { 0xfffe, 0}, },
- { &ops, PC97317_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0xfffa, 0}, },
- { &ops, PC97317_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x03fc, 0}, },
- { &ops, PC97317_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0xfff8, 0 }, },
- { &ops, PC97317_SP1, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 }, },
- { &ops, PC97317_GPIO, PNP_IO0, { 0xfff8, 0 } },
- { &ops, PC97317_PM, PNP_IO0, { 0xfffe, 0 } },
+ { &ops, PC97317_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0ffb, 0}, {0x0ffb, 4}, },
+ { &ops, PC97317_KBCM, PNP_IRQ0, },
+ { &ops, PC97317_RTC, PNP_IO0 | PNP_IRQ0, {0xfffe, 0}, },
+ { &ops, PC97317_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0xfffa, 0}, },
+ { &ops, PC97317_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x03fc, 0}, },
+ { &ops, PC97317_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0xfff8, 0}, },
+ { &ops, PC97317_SP1, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
+ { &ops, PC97317_GPIO, PNP_IO0, {0xfff8, 0}, },
+ { &ops, PC97317_PM, PNP_IO0, {0xfffe, 0}, },
};
static void enable_dev(struct device *dev)
{
- pnp_enable_devices(dev, &ops,
- ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_nsc_pc97317_ops = {