--- serial.c 2003-02-27 13:40:26.000000000 +0800
+++ serial.c_ite 2003-02-27 13:49:51.000000000
+0800
@@ -257,6 +257,13 @@
static struct timer_list serial_timer;
+//struct pci_dev *pcidev = NULL;
+// ITE8872 ITE8872
+u32 ITE8872_INTC[8];
+int ITEBOARDNUMBER=0;
+u8 ITE8872_IRQ[8];
+
+
/* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL
#define SERIAL_TYPE_NORMAL 1
@@ -4165,6 +4172,129 @@
}
EXPORT_SYMBOL(pci_siig20x_fn);
+void ite8872_requestirq(int irq,void *dev_id,struct
pt_regs *regs){
+ u8 itmp;
+ int i=0;
+ /* measure which INTC went to control */
+ for(i=0;i<8;i++)
+ if(irq == ITE8872_IRQ[i])
+ {
+ /* clean ITE8872 interrupt */
+ itmp = inb(ITE8872_INTC[i]+2);
+ if(!(itmp & 0x0f)) continue;
+ outb(itmp,ITE8872_INTC[i]+2);
+ break;
+ }
+}
+
+
+/*
+Integrated Technology Express, Inc.
+IT887x Device Driver
+*/
+static int __devinit
+
+pci_ite8872_fn(struct pci_dev *pcidev, struct pci_board
*board, int enable)
+{
+ int result,ite8872comnum=0,k;
+ short INTA_Addr[6]={ 0x2A0, 0x2C0, 0x220,
0x240, 0x1E0 };
+ u32
j=0,u32Tmp,itmp,ITE8872_COM1,ITE8872_COM2,ITE88
72SET=0x64E00000;
+ if (!enable) return 0;
+ // make sure which one chip
+ for(j=0; j<5; j++){
+ if(check_region(INTA_Addr[j], 0x8)
>=0){
+ pci_write_config_dword
(pcidev, 0x60,0xE7000000|INTA_Addr[j]);
+ pci_write_config_dword
(pcidev, 0x78,0x00000000|INTA_Addr[j]);
+ itmp = inb( INTA_Addr[j]);
+ if( itmp != 0xFF ) break;
+ }
+ }
+ if( j>=5 ){
+ printk(KERN_INFO "ITE8872 INTA
cannot find.\n");
+ return 0;
+ }
+ itmp = INTA_Addr[j];
+
+ u32Tmp = inb(itmp+0x18);
+ u32Tmp &= 0x0F;
+
+ switch(u32Tmp){
+ case 0x2:
+ printk
(KERN_INFO "<1> ITE8871 found , Parallel*1 \n");
+ return 0;
+ break;
+ case 0xA:
+ printk
(KERN_INFO "<1> ITE8875 found , Parallel*1 \n");
+ return 0;
+ break;
+ case 0xE:
+ printk
(KERN_INFO "<1> ITE8872 found , Serial *2 , Parallel*1
\n");
+ ite8872comnum = 2;
+
ITE8872SET=0x64E00000;
+ break;
+ case 0x6:
+ printk
(KERN_INFO "<1> ITE8873 found , Serial *1 \n");
+ ite8872comnum = 1;
+
ITE8872SET=0x64800000;
+ break;
+ case 0x8:
+ printk
(KERN_INFO "<1> ITE8874 found , Serial *2 \n");
+ ite8872comnum = 2;
+
ITE8872SET=0x64C00000;
+ break;
+ default:
+ printk
(KERN_INFO "serial: unknow ITE887x \n");
+ printk
(KERN_INFO "serial: please mail lspci -nvv output to
rich.liu@ite.com.tw\n");
+ return 0;
+ break;
+ }
+
+ //GET&#12288;IRQ
+ for (k=0; k < board->num_ports; k++) {
+ ITE8872_IRQ
[ITEBOARDNUMBER] = get_pci_irq( pcidev, board, k);
+ if (get_pci_port(pcidev, board,
&ITE8872_IRQ[ITEBOARDNUMBER], k))
+ break;}
+ printk(KERN_INFO "ITE887X_IRQ : %x \n",
ITE8872_IRQ[ITEBOARDNUMBER]);
+
+ result = request_irq(ITE8872_IRQ
[ITEBOARDNUMBER],ite8872_requestirq,SA_SHIRQ,"it
e8872",&ITE8872_IRQ[ITEBOARDNUMBER]);
+ if(result){
+ printk(KERN_INFO "ite8872: can't
get assign irq :%x \n",ITE8872_IRQ
[ITEBOARDNUMBER]);
+ return 0;
+ }
+
+
+ //INTC
+ pci_read_config_dword( pcidev, 0x10,
&ITE8872_INTC[ITEBOARDNUMBER]);
+ ITE8872_INTC[ITEBOARDNUMBER] &=
0x0000FF00;
+ pci_write_config_dword( pcidev, 0x60,
0xE5000000|ITE8872_INTC[ITEBOARDNUMBER] );
+ pci_write_config_dword( pcidev, 0x78,
ITE8872_INTC[ITEBOARDNUMBER] );
+
+ //COM1
+ pci_read_config_dword( pcidev,
0x14,&ITE8872_COM1);
+ ITE8872_COM1 &= 0x0000FF00;
+ pci_write_config_dword( pcidev, 0x64,
0xE3000000|ITE8872_COM1);
+
+ //COM2
+ if(ite8872comnum == 2){
+ pci_read_config_dword( pcidev,
0x18,&ITE8872_COM2);
+ ITE8872_COM2 &= 0x0000FF00;
+ pci_write_config_dword( pcidev, 0x68,
0xE3000000|ITE8872_COM2);
+ }
+ else{
+ ITE8872_COM2 = 0;
+ }
+ pci_write_config_dword( pcidev, 0x7C,
(ITE8872_COM2<<16)|(ITE8872_COM1) );
+
+ // 9C write enable UART , IRQ Function
+ pci_write_config_dword( pcidev,
0x9c,ITE8872SET|(0x11111*ITE8872_IRQ
[ITEBOARDNUMBER]));
+
+ // Add next interface
+ ITEBOARDNUMBER++;
+ return 0;
+
+}
+
+
/* Added for EKF Intel i960 serial boards */
static int __devinit
pci_inteli960ni_fn(struct pci_dev *dev,
@@ -4348,6 +4478,9 @@
#ifdef CONFIG_DDB5074
pbn_nec_nile4,
#endif
+#if 1
+ pbn_ite_8872,
+#endif
#if 0
pbn_dci_pccom8,
#endif
@@ -4444,6 +4577,10 @@
{ SPCI_FL_BASE0, 1, 520833,
/* pbn_nec_nile4 */
64, 3, NULL, 0x300 },
#endif
+#if 1 /* PCI_DEVCE_ID_ITE_8872 */
+ {SPCI_FL_BASE1| SPCI_FL_BASE_TABLE, 2,
115200,
+ 0, 0, pci_ite8872_fn, 0},
+#endif
#if 0 /* PCI_DEVICE_ID_DCI_PCCOM8 ? */
/* pbn_dci_pccom8 */
{ SPCI_FL_BASE3, 8, 115200, 8 },
#endif
@@ -4906,7 +5043,11 @@
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_nec_nile4 },
#endif
-
+#if 1 /* ITE 8872 Serial Simple Board */
+ { PCI_VENDOR_ID_ITE,
PCI_DEVICE_ID_ITE_8872,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+ pbn_ite_8872 },
+#endif
#if 0 /* PCI_DEVICE_ID_DCI_PCCOM8 ? */
{ PCI_VENDOR_ID_DCI,
PCI_DEVICE_ID_DCI_PCCOM8,
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
For those who should retain the answer as a result of an opponent, describe to the application due to this cause a fellow worker. [url=http://c88.fr/]shoes.fr[/url] <a href="http://c88.fr/" title="shoes.fr">shoes.fr</a>