···8686 depends on MACH_VR41XX && HW_HAS_PCI8787 default y8888 select PCI8989-9090-config VRC41739191- tristate "Add NEC VRC4173 companion chip support"9292- depends on MACH_VR41XX && PCI_VR41XX9393- help9494- The NEC VRC4173 is a companion chip for NEC VR4122/VR4131.
+1-2
arch/mips/vr41xx/common/Makefile
···22# Makefile for common code of the NEC VR4100 series.33#4455-obj-y += bcu.o cmu.o icu.o init.o irq.o pmu.o type.o66-obj-$(CONFIG_VRC4173) += vrc4173.o55+obj-y += bcu.o cmu.o icu.o init.o irq.o pmu.o type.o7687EXTRA_AFLAGS := $(CFLAGS)
-582
arch/mips/vr41xx/common/vrc4173.c
···11-/*22- * vrc4173.c, NEC VRC4173 base driver for NEC VR4122/VR4131.33- *44- * Copyright (C) 2001-2003 MontaVista Software Inc.55- * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>66- * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>77- * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)88- *99- * This program is free software; you can redistribute it and/or modify1010- * it under the terms of the GNU General Public License as published by1111- * the Free Software Foundation; either version 2 of the License, or1212- * (at your option) any later version.1313- *1414- * This program is distributed in the hope that it will be useful,1515- * but WITHOUT ANY WARRANTY; without even the implied warranty of1616- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1717- * GNU General Public License for more details.1818- *1919- * You should have received a copy of the GNU General Public License2020- * along with this program; if not, write to the Free Software2121- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2222- */2323-#include <linux/init.h>2424-#include <linux/module.h>2525-#include <linux/interrupt.h>2626-#include <linux/irq.h>2727-#include <linux/pci.h>2828-#include <linux/spinlock.h>2929-#include <linux/types.h>3030-3131-#include <asm/vr41xx/irq.h>3232-#include <asm/vr41xx/vr41xx.h>3333-#include <asm/vr41xx/vrc4173.h>3434-3535-MODULE_DESCRIPTION("NEC VRC4173 base driver for NEC VR4122/4131");3636-MODULE_AUTHOR("Yoichi Yuasa <yyuasa@mvista.com>");3737-MODULE_LICENSE("GPL");3838-3939-#define VRC4173_CMUCLKMSK 0x0404040- #define MSKPIU 0x00014141- #define MSKKIU 0x00024242- #define MSKAIU 0x00044343- #define MSKPS2CH1 0x00084444- #define MSKPS2CH2 0x00104545- #define MSKUSB 0x00204646- #define MSKCARD1 0x00404747- #define MSKCARD2 0x00804848- #define MSKAC97 0x01004949- #define MSK48MUSB 0x04005050- #define MSK48MPIN 0x08005151- #define MSK48MOSC 0x10005252-#define VRC4173_CMUSRST 0x0425353- #define USBRST 0x00015454- #define CARD1RST 0x00025555- #define CARD2RST 0x00045656- #define AC97RST 0x00085757-5858-#define VRC4173_SYSINT1REG 0x0605959-#define VRC4173_MSYSINT1REG 0x06c6060-#define VRC4173_MPIUINTREG 0x06e6161-#define VRC4173_MAIUINTREG 0x0706262-#define VRC4173_MKIUINTREG 0x0726363-6464-#define VRC4173_SELECTREG 0x09e6565- #define SEL3 0x00086666- #define SEL2 0x00046767- #define SEL1 0x00026868- #define SEL0 0x00016969-7070-static struct pci_device_id vrc4173_id_table[] __devinitdata = {7171- { .vendor = PCI_VENDOR_ID_NEC,7272- .device = PCI_DEVICE_ID_NEC_VRC4173,7373- .subvendor = PCI_ANY_ID,7474- .subdevice = PCI_ANY_ID, },7575- { .vendor = 0, },7676-};7777-7878-unsigned long vrc4173_io_offset = 0;7979-8080-EXPORT_SYMBOL(vrc4173_io_offset);8181-8282-static int vrc4173_initialized;8383-static uint16_t vrc4173_cmuclkmsk;8484-static uint16_t vrc4173_selectreg;8585-static DEFINE_SPINLOCK(vrc4173_cmu_lock);8686-static DEFINE_SPINLOCK(vrc4173_giu_lock);8787-8888-static inline void set_cmusrst(uint16_t val)8989-{9090- uint16_t cmusrst;9191-9292- cmusrst = vrc4173_inw(VRC4173_CMUSRST);9393- cmusrst |= val;9494- vrc4173_outw(cmusrst, VRC4173_CMUSRST);9595-}9696-9797-static inline void clear_cmusrst(uint16_t val)9898-{9999- uint16_t cmusrst;100100-101101- cmusrst = vrc4173_inw(VRC4173_CMUSRST);102102- cmusrst &= ~val;103103- vrc4173_outw(cmusrst, VRC4173_CMUSRST);104104-}105105-106106-void vrc4173_supply_clock(vrc4173_clock_t clock)107107-{108108- if (vrc4173_initialized) {109109- spin_lock_irq(&vrc4173_cmu_lock);110110-111111- switch (clock) {112112- case VRC4173_PIU_CLOCK:113113- vrc4173_cmuclkmsk |= MSKPIU;114114- break;115115- case VRC4173_KIU_CLOCK:116116- vrc4173_cmuclkmsk |= MSKKIU;117117- break;118118- case VRC4173_AIU_CLOCK:119119- vrc4173_cmuclkmsk |= MSKAIU;120120- break;121121- case VRC4173_PS2_CH1_CLOCK:122122- vrc4173_cmuclkmsk |= MSKPS2CH1;123123- break;124124- case VRC4173_PS2_CH2_CLOCK:125125- vrc4173_cmuclkmsk |= MSKPS2CH2;126126- break;127127- case VRC4173_USBU_PCI_CLOCK:128128- set_cmusrst(USBRST);129129- vrc4173_cmuclkmsk |= MSKUSB;130130- break;131131- case VRC4173_CARDU1_PCI_CLOCK:132132- set_cmusrst(CARD1RST);133133- vrc4173_cmuclkmsk |= MSKCARD1;134134- break;135135- case VRC4173_CARDU2_PCI_CLOCK:136136- set_cmusrst(CARD2RST);137137- vrc4173_cmuclkmsk |= MSKCARD2;138138- break;139139- case VRC4173_AC97U_PCI_CLOCK:140140- set_cmusrst(AC97RST);141141- vrc4173_cmuclkmsk |= MSKAC97;142142- break;143143- case VRC4173_USBU_48MHz_CLOCK:144144- set_cmusrst(USBRST);145145- vrc4173_cmuclkmsk |= MSK48MUSB;146146- break;147147- case VRC4173_EXT_48MHz_CLOCK:148148- if (vrc4173_cmuclkmsk & MSK48MOSC)149149- vrc4173_cmuclkmsk |= MSK48MPIN;150150- else151151- printk(KERN_WARNING152152- "vrc4173_supply_clock: "153153- "Please supply VRC4173_48MHz_CLOCK first "154154- "rather than VRC4173_EXT_48MHz_CLOCK.\n");155155- break;156156- case VRC4173_48MHz_CLOCK:157157- vrc4173_cmuclkmsk |= MSK48MOSC;158158- break;159159- default:160160- printk(KERN_WARNING161161- "vrc4173_supply_clock: Invalid CLOCK value %u\n", clock);162162- break;163163- }164164-165165- vrc4173_outw(vrc4173_cmuclkmsk, VRC4173_CMUCLKMSK);166166-167167- switch (clock) {168168- case VRC4173_USBU_PCI_CLOCK:169169- case VRC4173_USBU_48MHz_CLOCK:170170- clear_cmusrst(USBRST);171171- break;172172- case VRC4173_CARDU1_PCI_CLOCK:173173- clear_cmusrst(CARD1RST);174174- break;175175- case VRC4173_CARDU2_PCI_CLOCK:176176- clear_cmusrst(CARD2RST);177177- break;178178- case VRC4173_AC97U_PCI_CLOCK:179179- clear_cmusrst(AC97RST);180180- break;181181- default:182182- break;183183- }184184-185185- spin_unlock_irq(&vrc4173_cmu_lock);186186- }187187-}188188-189189-EXPORT_SYMBOL(vrc4173_supply_clock);190190-191191-void vrc4173_mask_clock(vrc4173_clock_t clock)192192-{193193- if (vrc4173_initialized) {194194- spin_lock_irq(&vrc4173_cmu_lock);195195-196196- switch (clock) {197197- case VRC4173_PIU_CLOCK:198198- vrc4173_cmuclkmsk &= ~MSKPIU;199199- break;200200- case VRC4173_KIU_CLOCK:201201- vrc4173_cmuclkmsk &= ~MSKKIU;202202- break;203203- case VRC4173_AIU_CLOCK:204204- vrc4173_cmuclkmsk &= ~MSKAIU;205205- break;206206- case VRC4173_PS2_CH1_CLOCK:207207- vrc4173_cmuclkmsk &= ~MSKPS2CH1;208208- break;209209- case VRC4173_PS2_CH2_CLOCK:210210- vrc4173_cmuclkmsk &= ~MSKPS2CH2;211211- break;212212- case VRC4173_USBU_PCI_CLOCK:213213- set_cmusrst(USBRST);214214- vrc4173_cmuclkmsk &= ~MSKUSB;215215- break;216216- case VRC4173_CARDU1_PCI_CLOCK:217217- set_cmusrst(CARD1RST);218218- vrc4173_cmuclkmsk &= ~MSKCARD1;219219- break;220220- case VRC4173_CARDU2_PCI_CLOCK:221221- set_cmusrst(CARD2RST);222222- vrc4173_cmuclkmsk &= ~MSKCARD2;223223- break;224224- case VRC4173_AC97U_PCI_CLOCK:225225- set_cmusrst(AC97RST);226226- vrc4173_cmuclkmsk &= ~MSKAC97;227227- break;228228- case VRC4173_USBU_48MHz_CLOCK:229229- set_cmusrst(USBRST);230230- vrc4173_cmuclkmsk &= ~MSK48MUSB;231231- break;232232- case VRC4173_EXT_48MHz_CLOCK:233233- vrc4173_cmuclkmsk &= ~MSK48MPIN;234234- break;235235- case VRC4173_48MHz_CLOCK:236236- vrc4173_cmuclkmsk &= ~MSK48MOSC;237237- break;238238- default:239239- printk(KERN_WARNING "vrc4173_mask_clock: Invalid CLOCK value %u\n", clock);240240- break;241241- }242242-243243- vrc4173_outw(vrc4173_cmuclkmsk, VRC4173_CMUCLKMSK);244244-245245- switch (clock) {246246- case VRC4173_USBU_PCI_CLOCK:247247- case VRC4173_USBU_48MHz_CLOCK:248248- clear_cmusrst(USBRST);249249- break;250250- case VRC4173_CARDU1_PCI_CLOCK:251251- clear_cmusrst(CARD1RST);252252- break;253253- case VRC4173_CARDU2_PCI_CLOCK:254254- clear_cmusrst(CARD2RST);255255- break;256256- case VRC4173_AC97U_PCI_CLOCK:257257- clear_cmusrst(AC97RST);258258- break;259259- default:260260- break;261261- }262262-263263- spin_unlock_irq(&vrc4173_cmu_lock);264264- }265265-}266266-267267-EXPORT_SYMBOL(vrc4173_mask_clock);268268-269269-static inline void vrc4173_cmu_init(void)270270-{271271- vrc4173_cmuclkmsk = vrc4173_inw(VRC4173_CMUCLKMSK);272272-273273- spin_lock_init(&vrc4173_cmu_lock);274274-}275275-276276-void vrc4173_select_function(vrc4173_function_t function)277277-{278278- if (vrc4173_initialized) {279279- spin_lock_irq(&vrc4173_giu_lock);280280-281281- switch(function) {282282- case PS2_CHANNEL1:283283- vrc4173_selectreg |= SEL2;284284- break;285285- case PS2_CHANNEL2:286286- vrc4173_selectreg |= SEL1;287287- break;288288- case TOUCHPANEL:289289- vrc4173_selectreg &= SEL2 | SEL1 | SEL0;290290- break;291291- case KEYBOARD_8SCANLINES:292292- vrc4173_selectreg &= SEL3 | SEL2 | SEL1;293293- break;294294- case KEYBOARD_10SCANLINES:295295- vrc4173_selectreg &= SEL3 | SEL2;296296- break;297297- case KEYBOARD_12SCANLINES:298298- vrc4173_selectreg &= SEL3;299299- break;300300- case GPIO_0_15PINS:301301- vrc4173_selectreg |= SEL0;302302- break;303303- case GPIO_16_20PINS:304304- vrc4173_selectreg |= SEL3;305305- break;306306- }307307-308308- vrc4173_outw(vrc4173_selectreg, VRC4173_SELECTREG);309309-310310- spin_unlock_irq(&vrc4173_giu_lock);311311- }312312-}313313-314314-EXPORT_SYMBOL(vrc4173_select_function);315315-316316-static inline void vrc4173_giu_init(void)317317-{318318- vrc4173_selectreg = vrc4173_inw(VRC4173_SELECTREG);319319-320320- spin_lock_init(&vrc4173_giu_lock);321321-}322322-323323-void vrc4173_enable_piuint(uint16_t mask)324324-{325325- struct irq_desc *desc = irq_desc + VRC4173_PIU_IRQ;326326- unsigned long flags;327327- uint16_t val;328328-329329- spin_lock_irqsave(&desc->lock, flags);330330- val = vrc4173_inw(VRC4173_MPIUINTREG);331331- val |= mask;332332- vrc4173_outw(val, VRC4173_MPIUINTREG);333333- spin_unlock_irqrestore(&desc->lock, flags);334334-}335335-336336-EXPORT_SYMBOL(vrc4173_enable_piuint);337337-338338-void vrc4173_disable_piuint(uint16_t mask)339339-{340340- struct irq_desc *desc = irq_desc + VRC4173_PIU_IRQ;341341- unsigned long flags;342342- uint16_t val;343343-344344- spin_lock_irqsave(&desc->lock, flags);345345- val = vrc4173_inw(VRC4173_MPIUINTREG);346346- val &= ~mask;347347- vrc4173_outw(val, VRC4173_MPIUINTREG);348348- spin_unlock_irqrestore(&desc->lock, flags);349349-}350350-351351-EXPORT_SYMBOL(vrc4173_disable_piuint);352352-353353-void vrc4173_enable_aiuint(uint16_t mask)354354-{355355- struct irq_desc *desc = irq_desc + VRC4173_AIU_IRQ;356356- unsigned long flags;357357- uint16_t val;358358-359359- spin_lock_irqsave(&desc->lock, flags);360360- val = vrc4173_inw(VRC4173_MAIUINTREG);361361- val |= mask;362362- vrc4173_outw(val, VRC4173_MAIUINTREG);363363- spin_unlock_irqrestore(&desc->lock, flags);364364-}365365-366366-EXPORT_SYMBOL(vrc4173_enable_aiuint);367367-368368-void vrc4173_disable_aiuint(uint16_t mask)369369-{370370- struct irq_desc *desc = irq_desc + VRC4173_AIU_IRQ;371371- unsigned long flags;372372- uint16_t val;373373-374374- spin_lock_irqsave(&desc->lock, flags);375375- val = vrc4173_inw(VRC4173_MAIUINTREG);376376- val &= ~mask;377377- vrc4173_outw(val, VRC4173_MAIUINTREG);378378- spin_unlock_irqrestore(&desc->lock, flags);379379-}380380-381381-EXPORT_SYMBOL(vrc4173_disable_aiuint);382382-383383-void vrc4173_enable_kiuint(uint16_t mask)384384-{385385- struct irq_desc *desc = irq_desc + VRC4173_KIU_IRQ;386386- unsigned long flags;387387- uint16_t val;388388-389389- spin_lock_irqsave(&desc->lock, flags);390390- val = vrc4173_inw(VRC4173_MKIUINTREG);391391- val |= mask;392392- vrc4173_outw(val, VRC4173_MKIUINTREG);393393- spin_unlock_irqrestore(&desc->lock, flags);394394-}395395-396396-EXPORT_SYMBOL(vrc4173_enable_kiuint);397397-398398-void vrc4173_disable_kiuint(uint16_t mask)399399-{400400- struct irq_desc *desc = irq_desc + VRC4173_KIU_IRQ;401401- unsigned long flags;402402- uint16_t val;403403-404404- spin_lock_irqsave(&desc->lock, flags);405405- val = vrc4173_inw(VRC4173_MKIUINTREG);406406- val &= ~mask;407407- vrc4173_outw(val, VRC4173_MKIUINTREG);408408- spin_unlock_irqrestore(&desc->lock, flags);409409-}410410-411411-EXPORT_SYMBOL(vrc4173_disable_kiuint);412412-413413-static void enable_vrc4173_irq(unsigned int irq)414414-{415415- uint16_t val;416416-417417- val = vrc4173_inw(VRC4173_MSYSINT1REG);418418- val |= (uint16_t)1 << (irq - VRC4173_IRQ_BASE);419419- vrc4173_outw(val, VRC4173_MSYSINT1REG);420420-}421421-422422-static void disable_vrc4173_irq(unsigned int irq)423423-{424424- uint16_t val;425425-426426- val = vrc4173_inw(VRC4173_MSYSINT1REG);427427- val &= ~((uint16_t)1 << (irq - VRC4173_IRQ_BASE));428428- vrc4173_outw(val, VRC4173_MSYSINT1REG);429429-}430430-431431-static unsigned int startup_vrc4173_irq(unsigned int irq)432432-{433433- enable_vrc4173_irq(irq);434434- return 0; /* never anything pending */435435-}436436-437437-#define shutdown_vrc4173_irq disable_vrc4173_irq438438-#define ack_vrc4173_irq disable_vrc4173_irq439439-440440-static void end_vrc4173_irq(unsigned int irq)441441-{442442- if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))443443- enable_vrc4173_irq(irq);444444-}445445-446446-static struct irq_chip vrc4173_irq_type = {447447- .typename = "VRC4173",448448- .startup = startup_vrc4173_irq,449449- .shutdown = shutdown_vrc4173_irq,450450- .enable = enable_vrc4173_irq,451451- .disable = disable_vrc4173_irq,452452- .ack = ack_vrc4173_irq,453453- .end = end_vrc4173_irq,454454-};455455-456456-static int vrc4173_get_irq_number(int irq)457457-{458458- uint16_t status, mask;459459- int i;460460-461461- status = vrc4173_inw(VRC4173_SYSINT1REG);462462- mask = vrc4173_inw(VRC4173_MSYSINT1REG);463463-464464- status &= mask;465465- if (status) {466466- for (i = 0; i < 16; i++)467467- if (status & (0x0001 << i))468468- return VRC4173_IRQ(i);469469- }470470-471471- return -EINVAL;472472-}473473-474474-static inline int vrc4173_icu_init(int cascade_irq)475475-{476476- int i;477477-478478- if (cascade_irq < GIU_IRQ(0) || cascade_irq > GIU_IRQ(15))479479- return -EINVAL;480480-481481- vrc4173_outw(0, VRC4173_MSYSINT1REG);482482-483483- vr41xx_set_irq_trigger(GIU_IRQ_TO_PIN(cascade_irq), TRIGGER_LEVEL, SIGNAL_THROUGH);484484- vr41xx_set_irq_level(GIU_IRQ_TO_PIN(cascade_irq), LEVEL_LOW);485485-486486- for (i = VRC4173_IRQ_BASE; i <= VRC4173_IRQ_LAST; i++)487487- irq_desc[i].chip = &vrc4173_irq_type;488488-489489- return 0;490490-}491491-492492-static int __devinit vrc4173_probe(struct pci_dev *dev,493493- const struct pci_device_id *id)494494-{495495- unsigned long start, flags;496496- int err;497497-498498- err = pci_enable_device(dev);499499- if (err < 0) {500500- printk(KERN_ERR "vrc4173: Failed to enable PCI device, aborting\n");501501- return err;502502- }503503-504504- pci_set_master(dev);505505-506506- start = pci_resource_start(dev, 0);507507- if (start == 0) {508508- printk(KERN_ERR "vrc4173:No such PCI I/O resource, aborting\n");509509- return -ENXIO;510510- }511511-512512- flags = pci_resource_flags(dev, 0);513513- if ((flags & IORESOURCE_IO) == 0) {514514- printk(KERN_ERR "vrc4173: No such PCI I/O resource, aborting\n");515515- return -ENXIO;516516- }517517-518518- err = pci_request_regions(dev, "NEC VRC4173");519519- if (err < 0) {520520- printk(KERN_ERR "vrc4173: PCI resources are busy, aborting\n");521521- return err;522522- }523523-524524- set_vrc4173_io_offset(start);525525-526526- vrc4173_cmu_init();527527- vrc4173_giu_init();528528-529529- err = vrc4173_icu_init(dev->irq);530530- if (err < 0) {531531- printk(KERN_ERR "vrc4173: Invalid IRQ %d, aborting\n", dev->irq);532532- return err;533533- }534534-535535- err = vr41xx_cascade_irq(dev->irq, vrc4173_get_irq_number);536536- if (err < 0) {537537- printk(KERN_ERR "vrc4173: IRQ resource %d is busy, aborting\n", dev->irq);538538- return err;539539- }540540-541541- printk(KERN_INFO542542- "NEC VRC4173 at 0x%#08lx, IRQ is cascaded to %d\n", start, dev->irq);543543-544544- return 0;545545-}546546-547547-static void vrc4173_remove(struct pci_dev *dev)548548-{549549- free_irq(dev->irq, NULL);550550-551551- pci_release_regions(dev);552552-}553553-554554-static struct pci_driver vrc4173_driver = {555555- .name = "NEC VRC4173",556556- .probe = vrc4173_probe,557557- .remove = vrc4173_remove,558558- .id_table = vrc4173_id_table,559559-};560560-561561-static int __devinit vrc4173_init(void)562562-{563563- int err;564564-565565- err = pci_register_driver(&vrc4173_driver);566566- if (err < 0)567567- return err;568568-569569- vrc4173_initialized = 1;570570-571571- return 0;572572-}573573-574574-static void __devexit vrc4173_exit(void)575575-{576576- vrc4173_initialized = 0;577577-578578- pci_unregister_driver(&vrc4173_driver);579579-}580580-581581-module_init(vrc4173_init);582582-module_exit(vrc4173_exit);
-201
include/asm-mips/vr41xx/vrc4173.h
···11-/*22- * vrc4173.h, Include file for NEC VRC4173.33- *44- * Copyright (C) 2000 Michael R. McDonald55- * Copyright (C) 2001-2003 Montavista Software Inc.66- * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>77- * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>88- * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)99- *1010- * This program is free software; you can redistribute it and/or modify1111- * it under the terms of the GNU General Public License as published by1212- * the Free Software Foundation; either version 2 of the License, or1313- * (at your option) any later version.1414- *1515- * This program is distributed in the hope that it will be useful,1616- * but WITHOUT ANY WARRANTY; without even the implied warranty of1717- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1818- * GNU General Public License for more details.1919- *2020- * You should have received a copy of the GNU General Public License2121- * along with this program; if not, write to the Free Software2222- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2323- */2424-#ifndef __NEC_VRC4173_H2525-#define __NEC_VRC4173_H2626-2727-#include <asm/io.h>2828-2929-/*3030- * PCI I/O accesses3131- */3232-#ifdef CONFIG_VRC41733333-3434-extern unsigned long vrc4173_io_offset;3535-3636-#define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)3737-3838-#define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))3939-#define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))4040-#define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))4141-#define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))4242-#define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))4343-#define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))4444-4545-#define vrc4173_inb(port) inb(vrc4173_io_offset+(port))4646-#define vrc4173_inw(port) inw(vrc4173_io_offset+(port))4747-#define vrc4173_inl(port) inl(vrc4173_io_offset+(port))4848-#define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))4949-#define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))5050-#define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))5151-5252-#define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))5353-#define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))5454-#define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))5555-5656-#define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))5757-#define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))5858-#define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))5959-6060-#else6161-6262-#define set_vrc4173_io_offset(offset) do {} while (0)6363-6464-#define vrc4173_outb(val,port) do {} while (0)6565-#define vrc4173_outw(val,port) do {} while (0)6666-#define vrc4173_outl(val,port) do {} while (0)6767-#define vrc4173_outb_p(val,port) do {} while (0)6868-#define vrc4173_outw_p(val,port) do {} while (0)6969-#define vrc4173_outl_p(val,port) do {} while (0)7070-7171-#define vrc4173_inb(port) 07272-#define vrc4173_inw(port) 07373-#define vrc4173_inl(port) 07474-#define vrc4173_inb_p(port) 07575-#define vrc4173_inw_p(port) 07676-#define vrc4173_inl_p(port) 07777-7878-#define vrc4173_outsb(port,addr,count) do {} while (0)7979-#define vrc4173_outsw(port,addr,count) do {} while (0)8080-#define vrc4173_outsl(port,addr,count) do {} while (0)8181-8282-#define vrc4173_insb(port,addr,count) do {} while (0)8383-#define vrc4173_insw(port,addr,count) do {} while (0)8484-#define vrc4173_insl(port,addr,count) do {} while (0)8585-8686-#endif8787-8888-/*8989- * Clock Mask Unit9090- */9191-typedef enum vrc4173_clock {9292- VRC4173_PIU_CLOCK,9393- VRC4173_KIU_CLOCK,9494- VRC4173_AIU_CLOCK,9595- VRC4173_PS2_CH1_CLOCK,9696- VRC4173_PS2_CH2_CLOCK,9797- VRC4173_USBU_PCI_CLOCK,9898- VRC4173_CARDU1_PCI_CLOCK,9999- VRC4173_CARDU2_PCI_CLOCK,100100- VRC4173_AC97U_PCI_CLOCK,101101- VRC4173_USBU_48MHz_CLOCK,102102- VRC4173_EXT_48MHz_CLOCK,103103- VRC4173_48MHz_CLOCK,104104-} vrc4173_clock_t;105105-106106-#ifdef CONFIG_VRC4173107107-108108-extern void vrc4173_supply_clock(vrc4173_clock_t clock);109109-extern void vrc4173_mask_clock(vrc4173_clock_t clock);110110-111111-#else112112-113113-static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}114114-static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}115115-116116-#endif117117-118118-/*119119- * Interupt Control Unit120120- */121121-122122-#define VRC4173_PIUINT_COMMAND 0x0040123123-#define VRC4173_PIUINT_DATA 0x0020124124-#define VRC4173_PIUINT_PAGE1 0x0010125125-#define VRC4173_PIUINT_PAGE0 0x0008126126-#define VRC4173_PIUINT_DATALOST 0x0004127127-#define VRC4173_PIUINT_STATUSCHANGE 0x0001128128-129129-#ifdef CONFIG_VRC4173130130-131131-extern void vrc4173_enable_piuint(uint16_t mask);132132-extern void vrc4173_disable_piuint(uint16_t mask);133133-134134-#else135135-136136-static inline void vrc4173_enable_piuint(uint16_t mask) {}137137-static inline void vrc4173_disable_piuint(uint16_t mask) {}138138-139139-#endif140140-141141-#define VRC4173_AIUINT_INPUT_DMAEND 0x0800142142-#define VRC4173_AIUINT_INPUT_DMAHALT 0x0400143143-#define VRC4173_AIUINT_INPUT_DATALOST 0x0200144144-#define VRC4173_AIUINT_INPUT_DATA 0x0100145145-#define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008146146-#define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004147147-#define VRC4173_AIUINT_OUTPUT_NODATA 0x0002148148-149149-#ifdef CONFIG_VRC4173150150-151151-extern void vrc4173_enable_aiuint(uint16_t mask);152152-extern void vrc4173_disable_aiuint(uint16_t mask);153153-154154-#else155155-156156-static inline void vrc4173_enable_aiuint(uint16_t mask) {}157157-static inline void vrc4173_disable_aiuint(uint16_t mask) {}158158-159159-#endif160160-161161-#define VRC4173_KIUINT_DATALOST 0x0004162162-#define VRC4173_KIUINT_DATAREADY 0x0002163163-#define VRC4173_KIUINT_SCAN 0x0001164164-165165-#ifdef CONFIG_VRC4173166166-167167-extern void vrc4173_enable_kiuint(uint16_t mask);168168-extern void vrc4173_disable_kiuint(uint16_t mask);169169-170170-#else171171-172172-static inline void vrc4173_enable_kiuint(uint16_t mask) {}173173-static inline void vrc4173_disable_kiuint(uint16_t mask) {}174174-175175-#endif176176-177177-/*178178- * General-Purpose I/O Unit179179- */180180-typedef enum vrc4173_function {181181- PS2_CHANNEL1,182182- PS2_CHANNEL2,183183- TOUCHPANEL,184184- KEYBOARD_8SCANLINES,185185- KEYBOARD_10SCANLINES,186186- KEYBOARD_12SCANLINES,187187- GPIO_0_15PINS,188188- GPIO_16_20PINS,189189-} vrc4173_function_t;190190-191191-#ifdef CONFIG_VRC4173192192-193193-extern void vrc4173_select_function(vrc4173_function_t function);194194-195195-#else196196-197197-static inline void vrc4173_select_function(vrc4173_function_t function) {}198198-199199-#endif200200-201201-#endif /* __NEC_VRC4173_H */