]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] mips: ITE 8172 updates
authorRalf Bächle <ralf@linux-mips.org>
Wed, 2 Feb 2005 00:43:50 +0000 (16:43 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 2 Feb 2005 00:43:50 +0000 (16:43 -0800)
Minor updates for the ITE 8172 evaluation board, mostly to keep the bitrotting
code somewhat in touch with the rest of the universe.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/mips/configs/it8172_defconfig
arch/mips/configs/ivr_defconfig
arch/mips/ite-boards/generic/irq.c
drivers/char/ite_gpio.c
include/asm-mips/it8172/it8172_lpc.h [deleted file]
sound/oss/Kconfig
sound/oss/ite8172.c

index fab0041d9812155a3be26cc9f82aeac1493e2526..1ca7746388f0ef694ef8928ea321598294d6f4b9 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc2
-# Sun Nov 21 14:12:00 2004
+# Linux kernel version: 2.6.11-rc2
+# Wed Jan 26 02:49:05 2005
 #
 CONFIG_MIPS=y
 # CONFIG_MIPS64 is not set
@@ -87,6 +87,7 @@ CONFIG_MIPS_ITE8172=y
 # CONFIG_SNI_RM200_PCI is not set
 # CONFIG_TOSHIBA_RBTX4927 is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -94,7 +95,6 @@ CONFIG_ITE_BOARD_GEN=y
 CONFIG_IT8172_CIR=y
 CONFIG_IT8712=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_FB is not set
 
 #
 # CPU selection
@@ -133,6 +133,19 @@ CONFIG_HW_HAS_PCI=y
 # CONFIG_PCI is not set
 CONFIG_MMU=y
 
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
 #
 # Executable file formats
 #
@@ -149,6 +162,7 @@ CONFIG_TRAD_SIGNALS=y
 #
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -192,6 +206,7 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_XIP is not set
 
 #
 # Mapping drivers for chip access
@@ -209,6 +224,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
 # CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
 
 #
 # Disk-On-Chip Device Drivers
@@ -235,10 +251,12 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
 CONFIG_CDROM_PKTCDVD=m
@@ -252,6 +270,7 @@ CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
+CONFIG_ATA_OVER_ETH=m
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -443,6 +462,7 @@ CONFIG_SERIO=y
 # CONFIG_SERIO_I8042 is not set
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_LIBPS2 is not set
 CONFIG_SERIO_RAW=m
 
 #
@@ -500,7 +520,6 @@ CONFIG_LEGACY_PTY_COUNT=256
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -531,12 +550,14 @@ CONFIG_LEGACY_PTY_COUNT=256
 #
 # Graphics support
 #
+# CONFIG_FB is not set
 
 #
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -569,11 +590,25 @@ CONFIG_SOUND_IT8172=y
 # CONFIG_USB_ARCH_HAS_HCD is not set
 # CONFIG_USB_ARCH_HAS_OHCI is not set
 
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
 #
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
 #
 # File systems
 #
@@ -667,6 +702,11 @@ CONFIG_MSDOS_PARTITION=y
 #
 # CONFIG_NLS is not set
 
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
 #
 # Kernel hacking
 #
@@ -686,6 +726,10 @@ CONFIG_KEYS_DEBUG_PROC_KEYS=y
 #
 # CONFIG_CRYPTO is not set
 
+#
+# Hardware crypto devices
+#
+
 #
 # Library routines
 #
index 76a9522b0d3f795bb5697c9d5c478049f945f277..c6eef708be1e9bdaa16a20944cae80413ebe3e83 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc2
-# Sun Nov 21 14:12:01 2004
+# Linux kernel version: 2.6.11-rc2
+# Wed Jan 26 02:49:05 2005
 #
 CONFIG_MIPS=y
 # CONFIG_MIPS64 is not set
@@ -86,13 +86,13 @@ CONFIG_MIPS_IVR=y
 # CONFIG_SNI_RM200_PCI is not set
 # CONFIG_TOSHIBA_RBTX4927 is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_ITE_BOARD_GEN=y
 CONFIG_IT8172_CIR=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_FB is not set
 
 #
 # CPU selection
@@ -133,6 +133,20 @@ CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
 CONFIG_MMU=y
 
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
+
 #
 # Executable file formats
 #
@@ -149,6 +163,7 @@ CONFIG_TRAD_SIGNALS=y
 #
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -172,10 +187,12 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
 CONFIG_CDROM_PKTCDVD=m
@@ -189,6 +206,7 @@ CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
+CONFIG_ATA_OVER_ETH=m
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -413,6 +431,7 @@ CONFIG_SERIO=y
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_CT82C710 is not set
 # CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_LIBPS2 is not set
 CONFIG_SERIO_RAW=m
 
 #
@@ -468,7 +487,6 @@ CONFIG_RTC=y
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -499,12 +517,14 @@ CONFIG_RTC=y
 #
 # Graphics support
 #
+# CONFIG_FB is not set
 
 #
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -518,11 +538,25 @@ CONFIG_DUMMY_CONSOLE=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
 #
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
 #
 # File systems
 #
@@ -614,6 +648,11 @@ CONFIG_MSDOS_PARTITION=y
 #
 # CONFIG_NLS is not set
 
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
 #
 # Kernel hacking
 #
@@ -633,6 +672,10 @@ CONFIG_KEYS_DEBUG_PROC_KEYS=y
 #
 # CONFIG_CRYPTO is not set
 
+#
+# Hardware crypto devices
+#
+
 #
 # Library routines
 #
index af8232e0857d1f2d8a87e306e8672cc4c4637303..cb71b9024d6f9bad0c2292d8a8c5fa4d94dd9f00 100644 (file)
@@ -32,7 +32,6 @@
  *  with this program; if not, write  to the Free Software Foundation, Inc.,
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <asm/it8172/it8172_int.h>
 #include <asm/it8172/it8172_dbg.h>
 
-#undef DEBUG_IRQ
-#ifdef DEBUG_IRQ
-/* note: prints function name for you */
-#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
-#else
-#define DPRINTK(fmt, args...)
-#endif
-
 /* revisit */
 #define EXT_IRQ0_TO_IP 2 /* IP 2 */
 #define EXT_IRQ5_TO_IP 7 /* IP 7 */
@@ -81,111 +72,50 @@ extern asmlinkage void it8172_IRQ(void);
 struct it8172_intc_regs volatile *it8172_hw0_icregs =
        (struct it8172_intc_regs volatile *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_INTC_BASE));
 
-/* Function for careful CP0 interrupt mask access */
-static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask)
-{
-        unsigned long status = read_c0_status();
-        status &= ~((clr_mask & 0xFF) << 8);
-        status |=   (set_mask & 0xFF) << 8;
-        write_c0_status(status);
-}
-
-static inline void mask_irq(unsigned int irq_nr)
-{
-        modify_cp0_intmask(irq_nr, 0);
-}
-
-static inline void unmask_irq(unsigned int irq_nr)
-{
-        modify_cp0_intmask(0, irq_nr);
-}
-
-void local_disable_irq(unsigned int irq_nr)
-{
-        unsigned long flags;
-
-        local_irq_save(flags);
-       disable_it8172_irq(irq_nr);
-        local_irq_restore(flags);
-}
-
-void local_enable_irq(unsigned int irq_nr)
+static void disable_it8172_irq(unsigned int irq_nr)
 {
-       unsigned long flags;
-
-        local_irq_save(flags);
-       enable_it8172_irq(irq_nr);
-        local_irq_restore(flags);
-}
-
-
-void disable_it8172_irq(unsigned int irq_nr)
-{
-       DPRINTK("disable_it8172_irq %d\n", irq_nr);
-
        if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
                /* LPC interrupt */
-               DPRINTK("DB lpc_mask  %x\n", it8172_hw0_icregs->lpc_mask);
                it8172_hw0_icregs->lpc_mask |=
                        (1 << (irq_nr - IT8172_LPC_IRQ_BASE));
-               DPRINTK("DA lpc_mask  %x\n", it8172_hw0_icregs->lpc_mask);
-       }
-       else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
+       } else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
                /* Local Bus interrupt */
-               DPRINTK("DB lb_mask  %x\n", it8172_hw0_icregs->lb_mask);
                it8172_hw0_icregs->lb_mask |=
                        (1 << (irq_nr - IT8172_LB_IRQ_BASE));
-               DPRINTK("DA lb_mask  %x\n", it8172_hw0_icregs->lb_mask);
-       }
-       else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
+       } else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
                /* PCI and other interrupts */
-               DPRINTK("DB pci_mask  %x\n", it8172_hw0_icregs->pci_mask);
                it8172_hw0_icregs->pci_mask |=
                        (1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
-               DPRINTK("DA pci_mask  %x\n", it8172_hw0_icregs->pci_mask);
-       }
-       else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
+       } else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
                /* NMI interrupts */
-               DPRINTK("DB nmi_mask  %x\n", it8172_hw0_icregs->nmi_mask);
                it8172_hw0_icregs->nmi_mask |=
                        (1 << (irq_nr - IT8172_NMI_IRQ_BASE));
-               DPRINTK("DA nmi_mask  %x\n", it8172_hw0_icregs->nmi_mask);
-       }
-       else {
+       } else {
                panic("disable_it8172_irq: bad irq %d", irq_nr);
        }
 }
 
-void enable_it8172_irq(unsigned int irq_nr)
+static void enable_it8172_irq(unsigned int irq_nr)
 {
-       DPRINTK("enable_it8172_irq %d\n", irq_nr);
        if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
                /* LPC interrupt */
-               DPRINTK("EB before lpc_mask  %x\n", it8172_hw0_icregs->lpc_mask);
                it8172_hw0_icregs->lpc_mask &=
                        ~(1 << (irq_nr - IT8172_LPC_IRQ_BASE));
-               DPRINTK("EA after lpc_mask  %x\n", it8172_hw0_icregs->lpc_mask);
        }
        else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
                /* Local Bus interrupt */
-               DPRINTK("EB lb_mask  %x\n", it8172_hw0_icregs->lb_mask);
                it8172_hw0_icregs->lb_mask &=
                        ~(1 << (irq_nr - IT8172_LB_IRQ_BASE));
-               DPRINTK("EA lb_mask  %x\n", it8172_hw0_icregs->lb_mask);
        }
        else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
                /* PCI and other interrupts */
-               DPRINTK("EB pci_mask  %x\n", it8172_hw0_icregs->pci_mask);
                it8172_hw0_icregs->pci_mask &=
                        ~(1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
-               DPRINTK("EA pci_mask  %x\n", it8172_hw0_icregs->pci_mask);
        }
        else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
                /* NMI interrupts */
-               DPRINTK("EB nmi_mask  %x\n", it8172_hw0_icregs->nmi_mask);
                it8172_hw0_icregs->nmi_mask &=
                        ~(1 << (irq_nr - IT8172_NMI_IRQ_BASE));
-               DPRINTK("EA nmi_mask  %x\n", it8172_hw0_icregs->nmi_mask);
        }
        else {
                panic("enable_it8172_irq: bad irq %d", irq_nr);
@@ -243,7 +173,7 @@ void enable_cpu_timer(void)
         unsigned long flags;
 
         local_irq_save(flags);
-       unmask_irq(1<<EXT_IRQ5_TO_IP); /* timer interrupt */
+       set_c0_status(0x100 << EXT_IRQ5_TO_IP);
         local_irq_restore(flags);
 }
 
@@ -305,7 +235,6 @@ void mips_spurious_interrupt(struct pt_regs *regs)
        cause = read_c0_cause();
        printk("status %x cause %x\n", status, cause);
        printk("epc %x badvaddr %x \n", regs->cp0_epc, regs->cp0_badvaddr);
-//     while(1);
 #endif
 }
 
@@ -326,9 +255,7 @@ void it8172_hw0_irqdispatch(struct pt_regs *regs)
                        status >>= 1;
                }
                irq += IT8172_PCI_DEV_IRQ_BASE;
-               //printk("pci int %d\n", irq);
-       }
-       else if (intstatus & 0x1) {
+       } else if (intstatus & 0x1) {
                /* Local Bus interrupt */
                irq = 0;
                status |= it8172_hw0_icregs->lb_req;
@@ -337,9 +264,7 @@ void it8172_hw0_irqdispatch(struct pt_regs *regs)
                        status >>= 1;
                }
                irq += IT8172_LB_IRQ_BASE;
-               //printk("lb int %d\n", irq);
-       }
-       else if (intstatus & 0x2) {
+       } else if (intstatus & 0x2) {
                /* LPC interrupt */
                /* Since some lpc interrupts are edge triggered,
                 * we could lose an interrupt this way because
@@ -353,7 +278,6 @@ void it8172_hw0_irqdispatch(struct pt_regs *regs)
                        status >>= 1;
                }
                irq += IT8172_LPC_IRQ_BASE;
-               //printk("LPC int %d\n", irq);
        } else
                return;
 
index 1a4dfef7e46db125f2626306e11bec97ba410b3e..d1ed6ac950d1208891188d1972530262d46c85d9 100644 (file)
@@ -30,9 +30,7 @@
  *  with this program; if not, write  to the Free Software Foundation, Inc.,
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
@@ -238,10 +236,6 @@ EXPORT_SYMBOL(ite_gpio_int_wait);
 
 static int ite_gpio_open(struct inode *inode, struct file *file)
 {
-       unsigned int minor = iminor(inode); 
-       if (minor != GPIO_MINOR)
-               return -ENODEV;
-
        return 0;
 }
 
@@ -255,7 +249,6 @@ static int ite_gpio_release(struct inode *inode, struct file *file)
 static int ite_gpio_ioctl(struct inode *inode, struct file *file,
        unsigned int cmd, unsigned long arg)
 {
-
        static struct ite_gpio_ioctl_data ioctl_data;
 
        if (copy_from_user(&ioctl_data, (struct ite_gpio_ioctl_data *)arg,
@@ -314,10 +307,12 @@ static int ite_gpio_ioctl(struct inode *inode, struct file *file,
                        return -ENOIOCTLCMD;
 
        }
+
        return 0;
 }
 
-static void ite_gpio_irq_handler(int this_irq, void *dev_id, struct pt_regs *regs)
+static void ite_gpio_irq_handler(int this_irq, void *dev_id,
+       struct pt_regs *regs)
 {
        int i,line;
 
@@ -362,18 +357,15 @@ DEB(printk("interrupt 0x%x %d\n",ITE_GPAISR, i));
        }
 }
 
-static struct file_operations ite_gpio_fops =
-{
+static struct file_operations ite_gpio_fops = {
        .owner          = THIS_MODULE,
        .ioctl          = ite_gpio_ioctl,
        .open           = ite_gpio_open,
        .release        = ite_gpio_release,
 };
 
-/* GPIO_MINOR in include/linux/miscdevice.h */
-static struct miscdevice ite_gpio_miscdev =
-{
-       GPIO_MINOR,
+static struct miscdevice ite_gpio_miscdev = {
+       MISC_DYNAMIC_MINOR,
        "ite_gpio",
        &ite_gpio_fops
 };
@@ -416,7 +408,7 @@ int __init ite_gpio_init(void)
        return 0;
 }      
 
-void __exit ite_gpio_exit(void)
+static void __exit ite_gpio_exit(void)
 {
        misc_deregister(&ite_gpio_miscdev);
 }
diff --git a/include/asm-mips/it8172/it8172_lpc.h b/include/asm-mips/it8172/it8172_lpc.h
deleted file mode 100644 (file)
index 13b922a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * BRIEF MODULE DESCRIPTION
- *     IT8172 system controller defines.
- *
- * Copyright 2000 MontaVista Software Inc.
- * Author: MontaVista Software, Inc.
- *             ppopov@mvista.com or source@mvista.com
- *
- *  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 the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
index 0baa11c92aff151fea2204e11a9693992d0e9733..d303c2ed6e5a9f8c70ea8ec3c4721f27d33ada94 100644 (file)
@@ -204,6 +204,10 @@ config SOUND_HAL2
          Say Y or M if you have an SGI Indy system and want to be able to
          use it's on-board A2 audio system.
 
+config SOUND_IT8172
+       tristate "IT8172G Sound"
+       depends on SOUND_PRIME!=n && (MIPS_ITE8172 || MIPS_IVR) && SOUND
+
 config SOUND_VRC5477
        tristate "NEC Vrc5477 AC97 sound"
        depends on SOUND_PRIME!=n && DDB5477 && SOUND
index 57718fe9961cc02d06718ef4e439344544105cd3..58f879fda975ced1e91c742b735271a9e944c688 100644 (file)
 #define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
 
 
+#define IT8172_MODULE_NAME "IT8172 audio"
+#define PFX IT8172_MODULE_NAME
+
+#ifdef IT8172_DEBUG
+#define dbg(format, arg...) printk(KERN_DEBUG PFX ": " format "\n" , ## arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif
+#define err(format, arg...) printk(KERN_ERR PFX ": " format "\n" , ## arg)
+#define info(format, arg...) printk(KERN_INFO PFX ": " format "\n" , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
+
+
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
 
@@ -285,7 +298,7 @@ struct it8172_state {
        struct proc_dir_entry *ac97_ps;
 #endif /* IT8172_DEBUG */
 
-       struct ac97_codec *codec;
+       struct ac97_codec codec;
 
        unsigned short pcc, capcc;
        unsigned dacrate, adcrate;
@@ -664,7 +677,7 @@ static inline void dealloc_dmabuf(struct it8172_state *s, struct dmabuf *db)
                pend = virt_to_page(db->rawbuf +
                                    (PAGE_SIZE << db->buforder) - 1);
                for (page = virt_to_page(db->rawbuf); page <= pend; page++)
-                       mem_map_unreserve(page);
+                       ClearPageReserved(page);
                pci_free_consistent(s->dev, PAGE_SIZE << db->buforder,
                                    db->rawbuf, db->dmaaddr);
        }
@@ -697,7 +710,7 @@ static int prog_dmabuf(struct it8172_state *s, struct dmabuf *db,
                pend = virt_to_page(db->rawbuf +
                                    (PAGE_SIZE << db->buforder) - 1);
                for (page = virt_to_page(db->rawbuf); page <= pend; page++)
-                       mem_map_reserve(page);
+                       SetPageReserved(page);
        }
 
        db->count = 0;
@@ -858,12 +871,6 @@ static irqreturn_t it8172_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
 /* --------------------------------------------------------------------- */
 
-static loff_t it8172_llseek(struct file *file, loff_t offset, int origin)
-{
-       return -ESPIPE;
-}
-
-
 static int it8172_open_mixdev(struct inode *inode, struct file *file)
 {
        int minor = iminor(inode);
@@ -874,7 +881,7 @@ static int it8172_open_mixdev(struct inode *inode, struct file *file)
                if (list == &devs)
                        return -ENODEV;
                s = list_entry(list, struct it8172_state, devs);
-               if (s->codec->dev_mixer == minor)
+               if (s->codec.dev_mixer == minor)
                        break;
        }
        file->private_data = s;
@@ -998,14 +1005,14 @@ static int it8172_ioctl_mixdev(struct inode *inode, struct file *file,
                               unsigned int cmd, unsigned long arg)
 {
        struct it8172_state *s = (struct it8172_state *)file->private_data;
-       struct ac97_codec *codec = s->codec;
+       struct ac97_codec *codec = &s->codec;
 
        return mixdev_ioctl(codec, cmd, arg);
 }
 
 static /*const*/ struct file_operations it8172_mixer_fops = {
        .owner          = THIS_MODULE,
-       .llseek         = it8172_llseek,
+       .llseek         = no_llseek,
        .ioctl          = it8172_ioctl_mixdev,
        .open           = it8172_open_mixdev,
        .release        = it8172_release_mixdev,
@@ -1409,14 +1416,14 @@ static int it8172_ioctl(struct inode *inode, struct file *file,
        case SNDCTL_DSP_RESET:
                if (file->f_mode & FMODE_WRITE) {
                        stop_dac(s);
-                       synchronize_irq();
+                       synchronize_irq(s->irq);
                        s->dma_dac.count = s->dma_dac.total_bytes = 0;
                        s->dma_dac.nextIn = s->dma_dac.nextOut =
                                s->dma_dac.rawbuf;
                }
                if (file->f_mode & FMODE_READ) {
                        stop_adc(s);
-                       synchronize_irq();
+                       synchronize_irq(s->irq);
                        s->dma_adc.count = s->dma_adc.total_bytes = 0;
                        s->dma_adc.nextIn = s->dma_adc.nextOut =
                                s->dma_adc.rawbuf;
@@ -1651,7 +1658,9 @@ static int it8172_ioctl(struct inode *inode, struct file *file,
                if (count < 0)
                        count = 0;
                cinfo.blocks = count >> s->dma_adc.fragshift;
-               return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+               if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+                       return -EFAULT;
+               return 0;
 
        case SNDCTL_DSP_GETOPTR:
                if (!(file->f_mode & FMODE_READ))
@@ -1674,7 +1683,9 @@ static int it8172_ioctl(struct inode *inode, struct file *file,
                if (count < 0)
                        count = 0;
                cinfo.blocks = count >> s->dma_dac.fragshift;
-               return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+               if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+                       return -EFAULT;
+               return 0;
 
        case SNDCTL_DSP_GETBLKSIZE:
                if (file->f_mode & FMODE_WRITE)
@@ -1761,7 +1772,7 @@ static int it8172_ioctl(struct inode *inode, struct file *file,
                return -EINVAL;
        }
 
-       return mixdev_ioctl(s->codec, cmd, arg);
+       return mixdev_ioctl(&s->codec, cmd, arg);
 }
 
 
@@ -1871,7 +1882,7 @@ static int it8172_release(struct inode *inode, struct file *file)
 
 static /*const*/ struct file_operations it8172_audio_fops = {
        .owner          = THIS_MODULE,
-       .llseek         = it8172_llseek,
+       .llseek         = no_llseek,
        .read           = it8172_read,
        .write          = it8172_write,
        .poll           = it8172_poll,
@@ -1929,7 +1940,7 @@ static int proc_it8172_dump (char *buf, char **start, off_t fpos,
        len += sprintf (buf + len, "----------------------\n");
        for (cnt=0; cnt <= 0x7e; cnt = cnt +2)
                len+= sprintf (buf + len, "reg %02x = %04x\n",
-                              cnt, rdcodec(s->codec, cnt));
+                              cnt, rdcodec(&s->codec, cnt));
 
        if (fpos >=len){
                *start = buf;
@@ -1994,16 +2005,11 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
        s->vendor = pcidev->vendor;
        s->device = pcidev->device;
        pci_read_config_byte(pcidev, PCI_REVISION_ID, &s->rev);
-       
-       s->codec = ac97_alloc_codec();
-       if(s->codec == NULL)
-               goto err_codec;
-               
-       s->codec->private_data = s;
-       s->codec->id = 0;
-       s->codec->codec_read = rdcodec;
-       s->codec->codec_write = wrcodec;
-       s->codec->codec_wait = waitcodec;
+       s->codec.private_data = s;
+       s->codec.id = 0;
+       s->codec.codec_read = rdcodec;
+       s->codec.codec_write = wrcodec;
+       s->codec.codec_wait = waitcodec;
 
        if (!request_region(s->io, pci_resource_len(pcidev,0),
                            IT8172_MODULE_NAME)) {
@@ -2022,12 +2028,12 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
        /* register devices */
        if ((s->dev_audio = register_sound_dsp(&it8172_audio_fops, -1)) < 0)
                goto err_dev1;
-       if ((s->codec->dev_mixer =
+       if ((s->codec.dev_mixer =
             register_sound_mixer(&it8172_mixer_fops, -1)) < 0)
                goto err_dev2;
 
 #ifdef IT8172_DEBUG
-       /* intialize the debug proc device */
+       /* initialize the debug proc device */
        s->ps = create_proc_read_entry(IT8172_MODULE_NAME, 0, NULL,
                                       proc_it8172_dump, NULL);
 #endif /* IT8172_DEBUG */
@@ -2093,11 +2099,11 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
        outw(0, s->io+IT_AC_CODECC);
     
        /* codec init */
-       if (!ac97_probe_codec(s->codec))
+       if (!ac97_probe_codec(&s->codec))
                goto err_dev3;
 
        /* add I2S as allowable recording source */
-       s->codec->record_sources |= SOUND_MASK_I2S;
+       s->codec.record_sources |= SOUND_MASK_I2S;
        
        /* Enable Volume button interrupts */
        imc = inb(s->io+IT_AC_IMC);
@@ -2117,23 +2123,23 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
 
        /* set mic to be the recording source */
        val = SOUND_MASK_MIC;
-       mixdev_ioctl(s->codec, SOUND_MIXER_WRITE_RECSRC,
+       mixdev_ioctl(&s->codec, SOUND_MIXER_WRITE_RECSRC,
                     (unsigned long)&val);
 
        /* mute AC'97 master and PCM when in S/PDIF mode */
        if (s->spdif_volume != -1) {
                val = 0x0000;
-               s->codec->mixer_ioctl(s->codec, SOUND_MIXER_WRITE_VOLUME,
+               s->codec.mixer_ioctl(&s->codec, SOUND_MIXER_WRITE_VOLUME,
                                     (unsigned long)&val);
-               s->codec->mixer_ioctl(s->codec, SOUND_MIXER_WRITE_PCM,
+               s->codec.mixer_ioctl(&s->codec, SOUND_MIXER_WRITE_PCM,
                                     (unsigned long)&val);
        }
     
 #ifdef IT8172_DEBUG
        sprintf(proc_str, "driver/%s/%d/ac97", IT8172_MODULE_NAME,
-               s->codec->id);
+               s->codec.id);
        s->ac97_ps = create_proc_read_entry (proc_str, 0, NULL,
-                                            ac97_read_proc, s->codec);
+                                            ac97_read_proc, &s->codec);
 #endif
     
        /* store it in the driver field */
@@ -2147,7 +2153,7 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
        return 0;
 
  err_dev3:
-       unregister_sound_mixer(s->codec->dev_mixer);
+       unregister_sound_mixer(s->codec.dev_mixer);
  err_dev2:
        unregister_sound_dsp(s->dev_audio);
  err_dev1:
@@ -2156,8 +2162,6 @@ static int __devinit it8172_probe(struct pci_dev *pcidev,
  err_irq:
        release_region(s->io, pci_resource_len(pcidev,0));
  err_region:
-       ac97_release_codec(s->codec);
- err_codec:
        kfree(s);
        return -1;
 }
@@ -2173,12 +2177,11 @@ static void __devexit it8172_remove(struct pci_dev *dev)
        if (s->ps)
                remove_proc_entry(IT8172_MODULE_NAME, NULL);
 #endif /* IT8172_DEBUG */
-       synchronize_irq();
+       synchronize_irq(s->irq);
        free_irq(s->irq, s);
        release_region(s->io, pci_resource_len(dev,0));
        unregister_sound_dsp(s->dev_audio);
-       unregister_sound_mixer(s->codec->dev_mixer);
-       ac97_codec_release(s->codec);
+       unregister_sound_mixer(s->codec.dev_mixer);
        kfree(s);
        pci_set_drvdata(dev, NULL);
 }
@@ -2202,8 +2205,6 @@ static struct pci_driver it8172_driver = {
 
 static int __init init_it8172(void)
 {
-       if (!pci_present())   /* No PCI bus in this machine! */
-               return -ENODEV;
        info("version v0.5 time " __TIME__ " " __DATE__);
        return pci_module_init(&it8172_driver);
 }