Random Winbond Super I/O cosmetic and coding-style fixes.
authorUwe Hermann <uwe@hermann-uwe.de>
Wed, 10 Nov 2010 14:53:36 +0000 (14:53 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Wed, 10 Nov 2010 14:53:36 +0000 (14:53 +0000)
 - Whitespace, coding style, and typo fixes.

 - Drop unused/obsolete "#config chip.h".

 - Use u8/u16/etc. everywhere.

 - Use pnp_read_config()/pnp_write_config() instead of open-coding them.

 - Use pnp_set_logical_device() instead of open-coding it.

 - W83627EHG: Fix incorrect enable_hwm_smbus() code comment.

 - Use ARRAY_SIZE.

 - w83627hf/superio.c: w83627hf_16_bit_addr_qual(): Bugfix, the code was using
   'dev->path.pnp.port >> 8' as config port, which is incorrect in superio.c
   (which has a "real" device_t struct, in contrast to *_early_serial.c which
   uses "unsigned" as device_t where 'dev >> 8' is required).

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@6057 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

39 files changed:
src/superio/winbond/w83627dhg/Makefile.inc
src/superio/winbond/w83627dhg/superio.c
src/superio/winbond/w83627ehg/Makefile.inc
src/superio/winbond/w83627ehg/superio.c
src/superio/winbond/w83627ehg/w83627ehg.h
src/superio/winbond/w83627ehg/w83627ehg_early_init.c
src/superio/winbond/w83627ehg/w83627ehg_early_serial.c
src/superio/winbond/w83627hf/Makefile.inc
src/superio/winbond/w83627hf/chip.h
src/superio/winbond/w83627hf/superio.c
src/superio/winbond/w83627hf/w83627hf.h
src/superio/winbond/w83627hf/w83627hf_early_init.c
src/superio/winbond/w83627hf/w83627hf_early_serial.c
src/superio/winbond/w83627thf/Makefile.inc
src/superio/winbond/w83627thf/chip.h
src/superio/winbond/w83627thf/superio.c
src/superio/winbond/w83627thf/w83627thf.h
src/superio/winbond/w83627thf/w83627thf_early_serial.c
src/superio/winbond/w83627thg/Makefile.inc
src/superio/winbond/w83627thg/chip.h
src/superio/winbond/w83627thg/superio.c
src/superio/winbond/w83627thg/w83627thg.h
src/superio/winbond/w83627thg/w83627thg_early_serial.c
src/superio/winbond/w83627uhg/Makefile.inc
src/superio/winbond/w83627uhg/superio.c
src/superio/winbond/w83627uhg/w83627uhg_early_serial.c
src/superio/winbond/w83697hf/Makefile.inc
src/superio/winbond/w83697hf/superio.c
src/superio/winbond/w83697hf/w83697hf.h
src/superio/winbond/w83697hf/w83697hf_early_serial.c
src/superio/winbond/w83977f/Makefile.inc
src/superio/winbond/w83977f/superio.c
src/superio/winbond/w83977f/w83977f.h
src/superio/winbond/w83977f/w83977f_early_serial.c
src/superio/winbond/w83977tf/Makefile.inc
src/superio/winbond/w83977tf/chip.h
src/superio/winbond/w83977tf/superio.c
src/superio/winbond/w83977tf/w83977tf.h
src/superio/winbond/w83977tf/w83977tf_early_serial.c

index 033e367eb44520a60646c2da4fa477976c3b07aa..0b0bb8b40cd4972faba2870d382c2170cf0e662d 100644 (file)
@@ -18,5 +18,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627DHG) += superio.c
+
index 2a58ef774f772feb326654923ad0428bd03aed7b..7ed236775958f3a8a1cd5a195cc284a31e14070f 100644 (file)
@@ -39,14 +39,12 @@ static void pnp_exit_ext_func_mode(device_t dev)
 
 static void w83627dhg_init(device_t dev)
 {
-       struct superio_winbond_w83627dhg_config *conf;
+       struct superio_winbond_w83627dhg_config *conf = dev->chip_info;
        struct resource *res0, *res1;
 
        if (!dev->enabled)
                return;
 
-       conf = dev->chip_info;
-
        switch(dev->path.pnp.device) {
        case W83627DHG_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
index 1cecd88531b548d703e588d5e79f79fedf23bc04..0bff762f4700455d7f7ef3f82d1cf59833a4a87a 100644 (file)
@@ -19,5 +19,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627EHG) += superio.c
+
index 45410d1ff4a5524604b352cd724306b5f1eb2859..cc65a651608d66ed02423dec537e9a141ac100e2 100644 (file)
@@ -45,74 +45,74 @@ static void pnp_exit_ext_func_mode(device_t dev)
        outb(0xaa, dev->path.pnp.port);
 }
 
-static void pnp_write_index(unsigned long port_base, uint8_t reg, uint8_t value)
+static void pnp_write_index(u16 port, u8 reg, u8 value)
 {
-       outb(reg, port_base);
-       outb(value, port_base + 1);
+       outb(reg, port);
+       outb(value, port + 1);
 }
 
-static uint8_t pnp_read_index(unsigned long port_base, uint8_t reg)
+static u8 pnp_read_index(u16 port, u8 reg)
 {
-       outb(reg, port_base);
-       return inb(port_base + 1);
+       outb(reg, port);
+       return inb(port + 1);
 }
 
 static void enable_hwm_smbus(device_t dev)
 {
-       /* Set the pin 91,92 as I2C bus. */
-       uint8_t reg, value;
-       reg = 0x2a;
-       value = pnp_read_config(dev, reg);
-       value |= (1 << 1);
-       pnp_write_config(dev, reg, value);
+       u8 reg8;
+
+       /* Configure pins 91/92 as SDA/SCL (I2C bus). */
+       reg8 = pnp_read_config(dev, 0x2a);
+       reg8 |= (1 << 1);
+       pnp_write_config(dev, 0x2a, reg8);
 }
 
 static void init_acpi(device_t dev)
 {
-       uint8_t value = 0x20;
+       u8 value = 0x20; /* TODO: 0x20 value here never used? */
        int power_on = 1;
 
        get_option(&power_on, "power_on_after_fail");
        pnp_enter_ext_func_mode(dev);
-       pnp_write_index(dev->path.pnp.port, 7, 0x0a);
+       pnp_set_logical_device(dev);
        value = pnp_read_config(dev, 0xe4);
        value &= ~(3 << 5);
-       if (power_on) {
+       if (power_on)
                value |= (1 << 5);
-       }
        pnp_write_config(dev, 0xe4, value);
        pnp_exit_ext_func_mode(dev);
 }
 
-static void init_hwm(unsigned long base)
+static void init_hwm(u16 base)
 {
        int i;
-       uint8_t reg, value;
+       u8 reg, value;
 
        /* reg mask data */
-       unsigned hwm_reg_values[] = {
+       u8 hwm_reg_values[] = {
                0x40, 0xff, 0x81, /* Start HWM. */
-               0x48, 0x7f, 0x2a, /* Set SMBus base to 0x54 >> 1. */
+               0x48, 0x7f, 0x2a, /* Set SMBus base to 0x2a (0x54 >> 1). */
        };
 
-       for(i = 0; i < ARRAY_SIZE(hwm_reg_values); i += 3) {
+       for (i = 0; i < ARRAY_SIZE(hwm_reg_values); i += 3) {
                reg = hwm_reg_values[i];
                value = pnp_read_index(base, reg);
                value &= 0xff & (~(hwm_reg_values[i + 1]));
                value |= 0xff & hwm_reg_values[i + 2];
-               /* printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, value = 0x%02x\n", base, reg,value); */
+               printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, "
+                      "value = 0x%02x\n", base, reg, value);
                pnp_write_index(base, reg, value);
        }
 }
 
 static void w83627ehg_init(device_t dev)
 {
-       struct superio_winbond_w83627ehg_config *conf;
+       struct superio_winbond_w83627ehg_config *conf = dev->chip_info;
        struct resource *res0, *res1;
-       if (!dev->enabled) {
+
+       if (!dev->enabled)
                return;
-       }
-       conf = dev->chip_info;
+
        switch(dev->path.pnp.device) {
        case W83627EHG_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -152,7 +152,7 @@ static void w83627ehg_pnp_enable_resources(device_t dev)
 
        switch (dev->path.pnp.device) {
        case W83627EHG_HWM:
-               printk(BIOS_DEBUG, "w83627ehg hwm smbus enabled\n");
+               printk(BIOS_DEBUG, "W83627EHG HWM SMBus enabled\n");
                enable_hwm_smbus(dev);
                break;
        }
@@ -162,12 +162,13 @@ static void w83627ehg_pnp_enable_resources(device_t dev)
 
 static void w83627ehg_pnp_enable(device_t dev)
 {
-       if (!dev->enabled) {
-               pnp_enter_ext_func_mode(dev);
-               pnp_set_logical_device(dev);
-               pnp_set_enable(dev, 0);
-               pnp_exit_ext_func_mode(dev);
-       }
+       if (dev->enabled)
+               return;
+
+       pnp_enter_ext_func_mode(dev);
+       pnp_set_logical_device(dev);
+       pnp_set_enable(dev, 0);
+       pnp_exit_ext_func_mode(dev);
 }
 
 static struct device_operations ops = {
@@ -183,7 +184,6 @@ static struct pnp_info pnp_dev_info[] = {
        { &ops, W83627EHG_PP,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
        { &ops, W83627EHG_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627EHG_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
-       /* No 4 { 0,}, */
        { &ops, W83627EHG_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
        { &ops, W83627EHG_SFI, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627EHG_WDTO_PLED, },
@@ -201,8 +201,7 @@ static struct pnp_info pnp_dev_info[] = {
 
 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_winbond_w83627ehg_ops = {
index f03cf0672d12f1c57abb5eeb1525898188550ca7..60c2b064b26e95721474bea5c9dfc2e9c75e6089 100644 (file)
 #define SUPERIO_WINBOND_W83627EHG_W83627EHG_H
 
 #define W83627EHG_FDC              0   /* Floppy */
-#define W83627EHG_PP               1   /* Parallel Port */
+#define W83627EHG_PP               1   /* Parallel port */
 #define W83627EHG_SP1              2   /* Com1 */
 #define W83627EHG_SP2              3   /* Com2 */
-#define W83627EHG_KBC              5   /* Keyboard & Mouse */
-#define W83627EHG_GPIO_GAME_MIDI   7   /* GPIO1, GPIO6, Game Port and MIDI Port */
+#define W83627EHG_KBC              5   /* PS/2 keyboard & mouse */
+#define W83627EHG_GPIO_GAME_MIDI   7   /* GPIO1, GPIO6, Game port, MIDI port */
 #define W83627EHG_WDTO_PLED        8   /* TODO */
-#define W83627EHG_GPIO_SUSLED      9   /* GPIO2, GPIO3, GPIO4, GPIO5 and SUSLED */
+#define W83627EHG_GPIO_SUSLED      9   /* GPIO2, GPIO3, GPIO4, GPIO5, SUSLED */
 #define W83627EHG_ACPI            10   /* ACPI */
-#define W83627EHG_HWM             11   /* Hardware Monitor */
+#define W83627EHG_HWM             11   /* Hardware monitor */
 
-/* virtual devices sharing the enables are encoded as follows:
+/*
+ * Virtual devices sharing the enables are encoded as follows:
  *   VLDN = baseLDN[7:0] | [10:8] bitpos of enable in 0x30 of baseLDN
  */
 
-#define W83627EHG_SFI          ((1 << 8) | 6) /* Flash has bit1 as enable */
-#define W83627EHG_GPIO1                W83627EHG_GPIO_GAME_MIDI /* GPIO1 is at LDN 7, bit 0 */
-#define W83627EHG_GAME         ((1 << 8) | 7)
-#define W83627EHG_MIDI         ((2 << 8) | 7)
-#define W83627EHG_GPIO6                ((3 << 8) | 7)
+#define W83627EHG_SFI  ((1 << 8) | 6)           /* Flash has bit1 as enable */
+#define W83627EHG_GPIO1        W83627EHG_GPIO_GAME_MIDI /* GPIO1: LDN 7, bit 0 */
+#define W83627EHG_GAME ((1 << 8) | 7)
+#define W83627EHG_MIDI ((2 << 8) | 7)
+#define W83627EHG_GPIO6        ((3 << 8) | 7)
 
-#define W83627EHG_GPIO2                W83627EHG_GPIO_SUSLED /* GPIO2 is at LDN 9, bit 0 */
-#define W83627EHG_GPIO3                ((1 << 8) | 9)
-#define W83627EHG_GPIO4                ((2 << 8) | 9)
-#define W83627EHG_GPIO5                ((3 << 8) | 9)
+#define W83627EHG_GPIO2        W83627EHG_GPIO_SUSLED    /* GPIO2: LDN 9, bit 0 */
+#define W83627EHG_GPIO3        ((1 << 8) | 9)
+#define W83627EHG_GPIO4        ((2 << 8) | 9)
+#define W83627EHG_GPIO5        ((3 << 8) | 9)
 
 #if defined(__PRE_RAM__) && !defined(__ROMCC__)
-void w83627ehg_enable_dev(device_t dev, unsigned iobase);
+void w83627ehg_enable_dev(device_t dev, u16 iobase);
 void w83627ehg_disable_dev(device_t dev);
-void w83627ehg_enable_serial(device_t dev, unsigned iobase);
+void w83627ehg_enable_serial(device_t dev, u16 iobase);
 #endif
 
 #endif
index 0335a67be59c9d8ff48b10b7a695059c6667e89f..5e66fafadb2c29695e9ed707a6c0e1a9ff4b8cdb 100644 (file)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#include <stdint.h>
 #include <arch/romcc_io.h>
 #include "w83627ehg.h"
 
@@ -28,7 +29,7 @@ void w83627ehg_disable_dev(device_t dev)
        pnp_set_enable(dev, 0);
 }
 
-void w83627ehg_enable_dev(device_t dev, unsigned iobase)
+void w83627ehg_enable_dev(device_t dev, u16 iobase)
 {
        pnp_set_logical_device(dev);
        pnp_set_enable(dev, 0);
index 63b044a9e5e33508f2e46f9d07f3b366a38d8f34..deb8bf6566e3f04754c02606bc72253424482a7b 100644 (file)
 #include <arch/romcc_io.h>
 #include "w83627ehg.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-void w83627ehg_enable_serial(device_t dev, unsigned iobase)
+void w83627ehg_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
index 8b101e5d3b631e274faaa0c2668aa39526184bd3..3a23eeff13108e9b21496c526810e049247f5c9c 100644 (file)
@@ -20,5 +20,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627HF) += superio.c
+
index 20f3d1782f5542a6346132ac0a0981ebdd666d37..3b0d4aca69250ff7b0468a015c9bc5aaf35c8637 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
index b6918470e032207e2d62590c2668a68f730ebc16..3dbe8333fc3924a14af33d6e199485293e450a03 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * Copyright (C) 2004 Tyan
  * Copyright (C) 2010 Win Enterprises (anishp@win-ent.com)
  *
  * This program is free software; you can redistribute it and/or modify
@@ -45,95 +45,95 @@ static void pnp_exit_ext_func_mode(device_t dev)
        outb(0xaa, dev->path.pnp.port);
 }
 
-static void pnp_write_index(unsigned long port_base, uint8_t reg, uint8_t value)
+static void pnp_write_index(u16 port, u8 reg, u8 value)
 {
-       outb(reg, port_base);
-       outb(value, port_base + 1);
+       outb(reg, port);
+       outb(value, port + 1);
 }
 
-static uint8_t pnp_read_index(unsigned long port_base, uint8_t reg)
+static u8 pnp_read_index(u16 port, u8 reg)
 {
-       outb(reg, port_base);
-       return inb(port_base + 1);
+       outb(reg, port);
+       return inb(port + 1);
 }
 
 #if CONFIG_EXPERT
 static void w83627hf_16_bit_addr_qual(device_t dev)
 {
-      int port = dev->path.pnp.port >> 8;
-      pnp_enter_ext_func_mode(dev);
-      outb(0x24, port);
-      /* enable 16 bit address qualification */
-      outb(inb(port + 1) | 0x80, port + 1);
-      pnp_exit_ext_func_mode(dev);
+       u8 reg8;
+
+       /* Enable 16 bit address qualification. */
+       pnp_enter_ext_func_mode(dev);
+       reg8 = pnp_read_config(dev, 0x24);
+       reg8 |= (1 << 7);
+       pnp_write_config(dev, 0x24, reg8);
+       pnp_exit_ext_func_mode(dev);
 }
 #endif
 
 static void enable_hwm_smbus(device_t dev)
 {
-       /* set the pin 91,92 as I2C bus */
-       uint8_t reg, value;
-       reg = 0x2b;
-       value = pnp_read_config(dev, reg);
-       value &= 0x3f;
-       pnp_write_config(dev, reg, value);
+       u8 reg8;
+
+       /* Configure pins 91/92 as SDA/SCL (I2C bus). */
+       reg8 = pnp_read_config(dev, 0x2b);
+       reg8 &= 0x3f;
+       pnp_write_config(dev, 0x2b, reg8);
 }
 
 static void init_acpi(device_t dev)
 {
-       uint8_t  value = 0x20;
+       u8 value = 0x20; /* FIXME: The 0x20 value here is never used? */
        int power_on = 1;
 
        get_option(&power_on, "power_on_after_fail");
+
        pnp_enter_ext_func_mode(dev);
-       pnp_write_index(dev->path.pnp.port,7,0x0a);
+       pnp_set_logical_device(dev);
        value = pnp_read_config(dev, 0xE4);
-       value &= ~(3<<5);
-       if(power_on) {
-               value |= (1<<5);
-       }
+       value &= ~(3 << 5);
+       if (power_on)
+               value |= (1 << 5);
        pnp_write_config(dev, 0xE4, value);
        pnp_exit_ext_func_mode(dev);
 }
 
-static void init_hwm(unsigned long base)
+static void init_hwm(u16 base)
 {
-       uint8_t  reg, value;
+       u8 reg, value;
        int i;
 
-       unsigned  hwm_reg_values[] = {
-       /*      reg  mask  data */
-               0x40, 0xff, 0x81,  /* start HWM */
-               0x48, 0xaa, 0x2a,  /* set SMBus base to 0x54>>1 */
-               0x4a, 0x21, 0x21,  /* set T2 SMBus base to 0x92>>1 and T3 SMBus base to 0x94>>1 */
+       u8 hwm_reg_values[] = {
+       /*      reg   mask  data */
+               0x40, 0xff, 0x81, /* Start HWM. */
+               0x48, 0xaa, 0x2a, /* Set SMBus base to 0x2a (0x54 >> 1). */
+               0x4a, 0x21, 0x21, /* Set T2 SMBus base to 0x92>>1 and T3 SMBus base to 0x94>>1. */
                0x4e, 0x80, 0x00,
                0x43, 0x00, 0xff,
                0x44, 0x00, 0x3f,
                0x4c, 0xbf, 0x18,
-               0x4d, 0xff, 0x80   /* turn off beep */
-
+               0x4d, 0xff, 0x80, /* Turn off beep */
        };
 
-       for(i = 0; i<  ARRAY_SIZE(hwm_reg_values); i+=3 ) {
+       for (i = 0; i < ARRAY_SIZE(hwm_reg_values); i += 3) {
                reg = hwm_reg_values[i];
-               value = pnp_read_index(base, reg);
-               value &= 0xff & hwm_reg_values[i+1];
-               value |= 0xff & hwm_reg_values[i+2];
-#if 0
-               printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, value = 0x%02x\n", base, reg,value);
-#endif
+               value = pnp_read_index(base, reg);
+               value &= 0xff & hwm_reg_values[i + 1];
+               value |= 0xff & hwm_reg_values[i + 2];
+               printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, "
+                      "value = 0x%02x\n", base, reg, value);
                pnp_write_index(base, reg, value);
        }
 }
 
 static void w83627hf_init(device_t dev)
 {
-       struct superio_winbond_w83627hf_config *conf;
+       struct superio_winbond_w83627hf_config *conf = dev->chip_info;
        struct resource *res0, *res1;
-       if (!dev->enabled) {
+
+       if (!dev->enabled)
                return;
-       }
-       conf = dev->chip_info;
+
        switch(dev->path.pnp.device) {
        case W83627HF_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -172,7 +172,7 @@ static void w83627hf_pnp_enable_resources(device_t dev)
        pnp_enable_resources(dev);
        switch(dev->path.pnp.device) {
        case W83627HF_HWM:
-               printk(BIOS_DEBUG, "w83627hf hwm smbus enabled\n");
+               printk(BIOS_DEBUG, "W83627HF HWM SMBus enabled\n");
                enable_hwm_smbus(dev);
                break;
        }
@@ -181,14 +181,13 @@ static void w83627hf_pnp_enable_resources(device_t dev)
 
 static void w83627hf_pnp_enable(device_t dev)
 {
-       if (!dev->enabled) {
-               pnp_enter_ext_func_mode(dev);
-
-               pnp_set_logical_device(dev);
-               pnp_set_enable(dev, 0);
+       if (dev->enabled)
+               return;
 
-               pnp_exit_ext_func_mode(dev);
-       }
+       pnp_enter_ext_func_mode(dev);
+       pnp_set_logical_device(dev);
+       pnp_set_enable(dev, 0);
+       pnp_exit_ext_func_mode(dev);
 }
 
 static struct device_operations ops = {
@@ -204,7 +203,6 @@ static struct pnp_info pnp_dev_info[] = {
        { &ops, W83627HF_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
        { &ops, W83627HF_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627HF_SP2,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
-       /* No 4 { 0,}, */
        { &ops, W83627HF_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
        { &ops, W83627HF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627HF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 0x4}, },
@@ -216,8 +214,7 @@ static struct pnp_info pnp_dev_info[] = {
 
 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_winbond_w83627hf_ops = {
index cb186a90f66ec3f5f68b13f0a56fccb5971d0989..f0566fc30fffbea61e39a5e4a5527654018301b0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #define SUPERIO_WINBOND_W83627HF_W83627HF_H
 
 #define W83627HF_FDC              0   /* Floppy */
-#define W83627HF_PP               1   /* Parallel Port */
+#define W83627HF_PP               1   /* Parallel port */
 #define W83627HF_SP1              2   /* Com1 */
 #define W83627HF_SP2              3   /* Com2 */
-#define W83627HF_KBC              5   /* Keyboard & Mouse */
+#define W83627HF_KBC              5   /* PS/2 keyboard & mouse */
 #define W83627HF_CIR              6
 #define W83627HF_GAME_MIDI_GPIO1  7
 #define W83627HF_GPIO2            8
 #define W83627HF_GPIO3            9
 #define W83627HF_ACPI            10
-#define W83627HF_HWM             11   /* Hardware Monitor */
+#define W83627HF_HWM             11   /* Hardware monitor */
 
 /* #define W83627HF_GPIO_DEV PNP_DEV(0x2e, W83627HF_GPIO) */
 /* #define W83627HF_XBUS_DEV PNP_DEV(0x2e, W83627HF_XBUS) */
 
 #if defined(__PRE_RAM__) && !defined(__ROMCC__)
 void w83627hf_disable_dev(device_t dev);
-void w83627hf_enable_dev(device_t dev, unsigned iobase);
-void w83627hf_enable_serial(device_t dev, unsigned iobase);
+void w83627hf_enable_dev(device_t dev, u16 iobase);
+void w83627hf_enable_serial(device_t dev, u16 iobase);
 void w83627hf_set_clksel_48(device_t dev);
 #endif
 
index a74e10a4149613e6b01ea86375bbf81b330a0840..55ab2fa10904bb944dc083174176fdf9446eb84e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright 2003-2004 Linux Networx
- * Copyright 2004 Tyan By LYH change from PC87360
+ * Copyright 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 @@ void w83627hf_disable_dev(device_t dev)
        pnp_set_enable(dev, 0);
 }
 
-void w83627hf_enable_dev(device_t dev, unsigned iobase)
+void w83627hf_enable_dev(device_t dev, u16 iobase)
 {
        pnp_set_logical_device(dev);
        pnp_set_enable(dev, 0);
index 2bc6c1dddfa4fd5fffb69dad6b771ad3fa8daf86..14cad5dd66d484c80b21a15b79f22a4b420b72bb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * Copyright (C) 2004 Tyan
  * Copyright (C) 2010 Win Enterprises (anishp@win-ent.com)
  *
  * This program is free software; you can redistribute it and/or modify
 #include <arch/romcc_io.h>
 #include "w83627hf.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned port = dev>>8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned port = dev>>8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-void w83627hf_enable_serial(device_t dev, unsigned iobase)
+void w83627hf_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
@@ -49,10 +49,11 @@ void w83627hf_enable_serial(device_t dev, unsigned iobase)
 
 void w83627hf_set_clksel_48(device_t dev)
 {
-       unsigned port = dev >> 8;
+       u8 reg8;
+
        pnp_enter_ext_func_mode(dev);
-       outb(0x24, port);
-       /* Set CLKSEL (clock input on pin 1) to 48MHz. */
-       outb(inb(port + 1) | (1 << 6), port + 1);
+       reg8 = pnp_read_config(dev, 0x24);
+       reg8 |= (1 << 6); /* Set CLKSEL (clock input on pin 1) to 48MHz. */
+       pnp_write_config(dev, 0x24, reg8);
        pnp_exit_ext_func_mode(dev);
 }
index 6d4097b058efdca049bbaf48642d1b30631f99cd..4b40bb056a3f38460b4d814c7b4fbb432b6915ea 100644 (file)
@@ -20,5 +20,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627THF) += superio.c
+
index 427c34f598228ed7065527931572a2802d9de192..a70b6f26330625119555170c61ab477ff2eba650 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
index 515e7f08b86d49480e2a846ceae69af5bf99d0cf..021937e9886dcb142bbe86521dd99fdace259ec3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
@@ -45,15 +45,12 @@ static void w83627thf_exit_ext_func_mode(device_t dev)
 
 static void w83627thf_init(device_t dev)
 {
-       struct superio_winbond_w83627thf_config *conf;
+       struct superio_winbond_w83627thf_config *conf = dev->chip_info;
        struct resource *res0, *res1;
-       /* 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 W83627THF_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -105,7 +102,6 @@ static struct pnp_info pnp_dev_info[] = {
        { &ops, W83627THF_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
        { &ops, W83627THF_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627THF_SP2,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
-       /* No 4 { 0,}, */
        { &ops, W83627THF_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
        { &ops, W83627THF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627THF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
@@ -117,8 +113,7 @@ static struct pnp_info pnp_dev_info[] = {
 
 static void enable_dev(device_t 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_winbond_w83627thf_ops = {
index cc59b9dbb4f9e48e2cd8d0db878f20224ee0e587..baff178ba6e3159ae6f0a03757aa5bdd3d201a30 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #define SUPERIO_WINBOND_W83627THF_W83627THF_H
 
 #define W83627THF_FDC              0   /* Floppy */
-#define W83627THF_PP               1   /* Parallel Port */
+#define W83627THF_PP               1   /* Parallel port */
 #define W83627THF_SP1              2   /* Com1 */
 #define W83627THF_SP2              3   /* Com2 */
-#define W83627THF_KBC              5   /* Keyboard & Mouse */
+#define W83627THF_KBC              5   /* PS/2 keyboard & mouse */
 #define W83627THF_CIR              6
 #define W83627THF_GAME_MIDI_GPIO1  7
 #define W83627THF_GPIO2            8
 #define W83627THF_GPIO3            9
 #define W83627THF_ACPI            10
-#define W83627THF_HWM             11   /* Hardware Monitor */
+#define W83627THF_HWM             11   /* Hardware monitor */
 
 #endif
index 4931ad2da758cb86506ddafd870d4b4835c1bf7c..93f09efaa8fa67b30135233e29717586cc2020e0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #include <arch/romcc_io.h>
 #include "w83627thf.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-static void w83627thf_enable_serial(device_t dev, unsigned int iobase)
+static void w83627thf_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
index 1099a2dbe34247d011fce8ca84b5f181f6f71228..9d562e74603ea15f644dc2e6da1792d4f6d77d48 100644 (file)
@@ -20,5 +20,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627THG) += superio.c
+
index 30e0378d9921e99b7abbb1291ddc4a3ada1fce13..a2c9a0de6d331fc80babf608248fcca3970eaf3e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
index d6a74a194e5914c612c07a99a5426e0baeda108e..08044a8f5393d8e234aaafcea3fb5b28b7772583 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
@@ -36,6 +36,7 @@ static void w83627thg_enter_ext_func_mode(device_t dev)
        outb(0x87, dev->path.pnp.port);
        outb(0x87, dev->path.pnp.port);
 }
+
 static void w83627thg_exit_ext_func_mode(device_t dev)
 {
        outb(0xaa, dev->path.pnp.port);
@@ -43,15 +44,12 @@ static void w83627thg_exit_ext_func_mode(device_t dev)
 
 static void w83627thg_init(device_t dev)
 {
-       struct superio_winbond_w83627thg_config *conf;
+       struct superio_winbond_w83627thg_config *conf = dev->chip_info;
        struct resource *res0, *res1;
-       /* 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 W83627THG_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -103,7 +101,6 @@ static struct pnp_info pnp_dev_info[] = {
        { &ops, W83627THG_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
        { &ops, W83627THG_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83627THG_SP2,  PNP_IO0 | PNP_IRQ0 | PNP_MSC1, { 0x7f8, 0 }, },
-       /* No 4 { 0,}, */
        { &ops, W83627THG_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
        { &ops, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
        { &ops, W83627THG_GPIO2,},
@@ -114,8 +111,7 @@ static struct pnp_info pnp_dev_info[] = {
 
 static void enable_dev(device_t dev)
 {
-       pnp_enable_devices(dev, &ops,
-               sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info);
+       pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
 }
 
 struct chip_operations superio_winbond_w83627thg_ops = {
index a00814b6aec9da79434bdbe03d229e972a4c676e..73be5448890a545289f38e5ff09c6512e8b3ff0f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #define SUPERIO_WINBOND_W83627THG_W83627THG_H
 
 #define W83627THG_FDC              0   /* Floppy */
-#define W83627THG_PP               1   /* Parallel Port */
+#define W83627THG_PP               1   /* Parallel port */
 #define W83627THG_SP1              2   /* Com1 */
 #define W83627THG_SP2              3   /* Com2 */
-#define W83627THG_KBC              5   /* Keyboard & Mouse */
+#define W83627THG_KBC              5   /* PS/2 keyboard & mouse */
 #define W83627THG_GAME_MIDI_GPIO1  7
 #define W83627THG_GPIO2            8
 #define W83627THG_GPIO3            9
 #define W83627THG_ACPI            10
-#define W83627THG_HWM             11   /* Hardware Monitor */
+#define W83627THG_HWM             11   /* Hardware monitor */
 
 #endif
index a5707f5ee6470b70808700eb588475cb4d42019c..559e9827fcbbebd41f4fcf93342f9247313b9446 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #include <arch/romcc_io.h>
 #include "w83627thg.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-static inline void w83627thg_enable_serial(device_t dev, unsigned int iobase)
+static void inline w83627thg_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
index 05c5c368ea3d4646ca751f297da8ed49e9831d80..cdf711e3a35e4c3325eca0aaebff607d5b481b7d 100644 (file)
@@ -18,5 +18,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 $
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83627UHG) += superio.c
+
index 57c74b614da74eea719f900d7d0b26f857753f91..c80eb95d17a4e2bfa50ef1d1d2935ab027d2676b 100644 (file)
@@ -72,13 +72,12 @@ static void set_uart_clock_source(device_t dev, u8 uart_clock)
 
 static void w83627uhg_init(device_t dev)
 {
-       struct superio_winbond_w83627uhg_config *conf;
+       struct superio_winbond_w83627uhg_config *conf = dev->chip_info;
        struct resource *res0, *res1;
 
        if (!dev->enabled)
                return;
 
-       conf = dev->chip_info;
        switch(dev->path.pnp.device) {
        case W83627UHG_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
index ea796367267bea41c68de7d890275ae16e37d2e9..3636641f601a3c23e8a2242f5988d1a5523bfe02 100644 (file)
@@ -47,7 +47,7 @@ static void w83627uhg_set_input_clk_sel(device_t dev, u8 speed_24mhz)
        pnp_write_config(dev, 0x24, value);
 }
 
-static void w83627uhg_enable_serial(device_t dev, u32 iobase)
+static void w83627uhg_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
index e1e27b054c1e038f98d340bdde76539bce6af6e8..c6647d67572eeaeddade12f61101b72823170379 100644 (file)
@@ -18,5 +18,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83697HF) += superio.c
+
index 53e2a2bddb58bc09af26f0f11d313d49d8178fa9..ab594b47533ece84cf812ae9dd96dfea2c9a56e7 100644 (file)
@@ -43,13 +43,12 @@ static void pnp_exit_ext_func_mode(device_t dev)
 
 static void w83697hf_init(device_t dev)
 {
-       struct superio_winbond_w83697hf_config *conf;
+       struct superio_winbond_w83697hf_config *conf = dev->chip_info;
        struct resource *res0;
 
        if (!dev->enabled)
                return;
 
-       conf = dev->chip_info;
        switch(dev->path.pnp.device) {
        case W83697HF_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -71,12 +70,13 @@ static void w83697hf_pnp_set_resources(device_t dev)
 
 static void w83697hf_pnp_enable(device_t dev)
 {
-       if (!dev->enabled) {
-               pnp_enter_ext_func_mode(dev);
-               pnp_set_logical_device(dev);
-               pnp_set_enable(dev, 0);
-               pnp_exit_ext_func_mode(dev);
-       }
+       if (dev->enabled)
+               return;
+
+       pnp_enter_ext_func_mode(dev);
+       pnp_set_logical_device(dev);
+       pnp_set_enable(dev, 0);
+       pnp_exit_ext_func_mode(dev);
 }
 
 static void w83697hf_pnp_enable_resources(device_t dev)
index 3e979c911db34d3fb244dd088866d821840681a8..0eeb37c9c97b5f9998df316a959ff51e620e2894 100644 (file)
@@ -22,7 +22,7 @@
 #define SUPERIO_WINBOND_W83697HF_W83697HF_H
 
 #define W83697HF_FDC            0    /* Floppy */
-#define W83697HF_PP             1    /* Parallel Port */
+#define W83697HF_PP             1    /* Parallel port */
 #define W83697HF_SP1            2    /* Com1 */
 #define W83697HF_SP2            3    /* Com2 */
 #define W83697HF_CIR            6    /* Consumer IR */
@@ -30,6 +30,6 @@
 #define W83697HF_MIDI_GPIO5     8    /* MIDI, GPIO 5 */
 #define W83697HF_GPIO234        9    /* GPIO 2, 3, 4 */
 #define W83697HF_ACPI           10   /* ACPI */
-#define W83697HF_HWM            11   /* Hardware Monitor */
+#define W83697HF_HWM            11   /* Hardware monitor */
 
 #endif
index 1e05e38f40487fdc62331aa46b51d612187b6416..7731804699c4f745ff7949a304b7199916e395f8 100644 (file)
@@ -22,7 +22,7 @@
 #include <arch/romcc_io.h>
 #include "w83697hf.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
        u16 port = dev >> 8;
        outb(0x87, port);
@@ -37,11 +37,12 @@ static void pnp_exit_ext_func_mode(device_t dev)
 
 static void w83697hf_set_clksel_48(device_t dev)
 {
-       u16 port = dev >> 8;
+       u8 reg8;
+
        pnp_enter_ext_func_mode(dev);
-       outb(0x24, port);
-       /* Set the clock input to 48Mhz */
-       outb(inb(port+1)|0x40, port+1);
+       reg8 = pnp_read_config(dev, 0x24);
+       reg8 |= (1 << 6); /* Set the clock input to 48MHz. */
+       pnp_write_config(dev, 0x24, reg8);
        pnp_exit_ext_func_mode(dev);
 }
 
index fa2f260e2024c95944b40ae0d09443b2a9979c36..956403042ad3e255afa08e1e649a256816e4434d 100644 (file)
@@ -18,5 +18,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83977F) += superio.c
+
index 7e797f3fdbb765f4529f4aedb252c6e6eb1cff44..7ebfd293f38ba7215ffb7b126dd48cc825978d1d 100644 (file)
@@ -35,6 +35,7 @@ static void w83977f_enter_ext_func_mode(device_t dev)
        outb(0x87, dev->path.pnp.port);
        outb(0x87, dev->path.pnp.port);
 }
+
 static void w83977f_exit_ext_func_mode(device_t dev)
 {
        outb(0xaa, dev->path.pnp.port);
@@ -42,13 +43,12 @@ static void w83977f_exit_ext_func_mode(device_t dev)
 
 static void w83977f_init(device_t dev)
 {
-       struct superio_winbond_w83977f_config *conf;
+       struct superio_winbond_w83977f_config *conf = dev->chip_info;
        struct resource *res0, *res1;
 
-       if (!dev->enabled) {
+       if (!dev->enabled)
                return;
-       }
-       conf = dev->chip_info;
+
        switch(dev->path.pnp.device) {
        case W83977F_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -109,11 +109,10 @@ static struct pnp_info pnp_dev_info[] = {
 
 static void enable_dev(device_t 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_winbond_w83977f_ops = {
-       CHIP_NAME("Winbond W83977F-A Super I/O")
+       CHIP_NAME("Winbond W83977F Super I/O")
        .enable_dev = enable_dev,
 };
index 25eb1cbc7fd78e3a5670222f96af331a6e4e9dab..086134682aa562ee8f65b106e36b0ea30b3a6560 100644 (file)
 #define SUPERIO_WINBOND_W83977F_W83977F_H
 
 #define W83977F_FDC    0       /* Floppy */
-#define W83977F_PP     1       /* Parallel Port */
+#define W83977F_PP     1       /* Parallel port */
 #define W83977F_SP1    2       /* Com1 */
 #define W83977F_SP2    3       /* Com2 */
 #define W83977F_RTC    4       /* RTC */
-#define W83977F_KBC    5       /* Keyboard & Mouse */
-#define W83977F_IR     6       /* Infrared Port */
+#define W83977F_KBC    5       /* PS/2 keyboard & mouse */
+#define W83977F_IR     6       /* Infrared port */
 #define W83977F_GPIO1  7       /* General Purpose I/O 1 */
 #define W83977F_GPIO2  8       /* General Purpose I/O 2 */
 
index a42688938dd0d320960c9d9a74473d347e05d917..f0fb1da6d5ecd311fd31a878a1248074e214ba59 100644 (file)
 #include <arch/romcc_io.h>
 #include "w83977f.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-static void w83977f_enable_serial(device_t dev, unsigned int iobase)
+static void w83977f_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);
index 62a50fc6981b745a53e9a9bc9baee777566be11e..91073cf2c8854e194266c7ad7274155a375bee38 100644 (file)
@@ -20,5 +20,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#config chip.h
 ramstage-$(CONFIG_SUPERIO_WINBOND_W83977TF) += superio.c
+
index 1af2f94d061476972d51f059e8d7ee88dd7b4902..e50f00661f0458bc9d7da18e3d51a0702b6e75f8 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
index 58ad008c960c08aa10a8e94a775e1a795c0982de..3cfb1de543a4a1822991c87082d0b7a17f39e8cb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-/* 2006-4-24
- * Adapted for the w83977 by rsmith <smithbone@gmail.com>
- * This is mostly just a search and replace on the part type
- * TODO: Actually see if all the sub functionis exist and are
- *       setup correctly.
- */
-
 #include <arch/io.h>
 #include <device/device.h>
 #include <device/pnp.h>
@@ -44,6 +37,7 @@ static void w83977tf_enter_ext_func_mode(device_t dev)
        outb(0x87, dev->path.pnp.port);
        outb(0x87, dev->path.pnp.port);
 }
+
 static void w83977tf_exit_ext_func_mode(device_t dev)
 {
        outb(0xaa, dev->path.pnp.port);
@@ -51,15 +45,12 @@ static void w83977tf_exit_ext_func_mode(device_t dev)
 
 static void w83977tf_init(device_t dev)
 {
-       struct superio_winbond_w83977tf_config *conf;
+       struct superio_winbond_w83977tf_config *conf = dev->chip_info;
        struct resource *res0, *res1;
-       /* 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 W83977TF_SP1:
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -111,7 +102,6 @@ static struct pnp_info pnp_dev_info[] = {
        { &ops, W83977TF_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
        { &ops, W83977TF_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83977TF_SP2,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
-       /* No 4 { 0,}, */
        { &ops, W83977TF_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
        { &ops, W83977TF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
        { &ops, W83977TF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
@@ -120,8 +110,7 @@ static struct pnp_info pnp_dev_info[] = {
 
 static void enable_dev(device_t 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_winbond_w83977tf_ops = {
index 2e0e9232f00b0892f5561f50be18663c680e0ba9..8426c4accb8e3cb27d221eacca272ea3952990d4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #define SUPERIO_WINBOND_W83977TF_W83977TF_H
 
 #define W83977TF_FDC              0   /* Floppy */
-#define W83977TF_PP               1   /* Parallel Port */
+#define W83977TF_PP               1   /* Parallel port */
 #define W83977TF_SP1              2   /* Com1 */
 #define W83977TF_SP2              3   /* Com2 */
-#define W83977TF_KBC              5   /* Keyboard & Mouse */
+#define W83977TF_KBC              5   /* PS/2 keyboard & mouse */
 #define W83977TF_CIR              6
 #define W83977TF_GAME_MIDI_GPIO1  7
 #define W83977TF_GPIO2            8
index dbc8dcbef1207346cc8b1e7fb28c0764872af0b9..fb4590b50ae08a4c72834a0febef9caa6129f130 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000 AG Electronics Ltd.
  * Copyright (C) 2003-2004 Linux Networx
- * Copyright (C) 2004 Tyan By LYH change from PC87360
+ * 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
 #include <arch/romcc_io.h>
 #include "w83977tf.h"
 
-static inline void pnp_enter_ext_func_mode(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0x87, port);
        outb(0x87, port);
 }
 
 static void pnp_exit_ext_func_mode(device_t dev)
 {
-       unsigned int port = dev >> 8;
+       u16 port = dev >> 8;
        outb(0xaa, port);
 }
 
-static void w83977tf_enable_serial(device_t dev, unsigned int iobase)
+static void w83977tf_enable_serial(device_t dev, u16 iobase)
 {
        pnp_enter_ext_func_mode(dev);
        pnp_set_logical_device(dev);