patch-2.4.25 linux-2.4.25/drivers/net/irda/au1k_ir.c
Next file: linux-2.4.25/drivers/net/irda/irda-usb.c
Previous file: linux-2.4.25/drivers/net/irda/act200l.c
Back to the patch index
Back to the overall index
- Lines: 171
- Date:
2004-02-18 05:36:31.000000000 -0800
- Orig file:
linux-2.4.24/drivers/net/irda/au1k_ir.c
- Orig date:
2002-08-02 17:39:44.000000000 -0700
diff -urN linux-2.4.24/drivers/net/irda/au1k_ir.c linux-2.4.25/drivers/net/irda/au1k_ir.c
@@ -46,7 +46,13 @@
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/au1000.h>
+#if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100)
#include <asm/pb1000.h>
+#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+#include <asm/db1x00.h>
+#else
+#error au1k_ir: unsupported board
+#endif
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
@@ -71,10 +77,16 @@
static int qos_mtt_bits = 0x07; /* 1 ms or more */
static struct net_device *ir_devs[NUM_IR_IFF];
static char version[] __devinitdata =
- "au1k_ircc:1.0 ppopov@mvista.com\n";
+ "au1k_ircc:1.2 ppopov@mvista.com\n";
#define RUN_AT(x) (jiffies + (x))
+#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+static BCSR * const bcsr = (BCSR *)0xAE000000;
+#endif
+
+static spinlock_t ir_lock = SPIN_LOCK_UNLOCKED;
+
/*
* IrDA peripheral bug. You have to read the register
* twice to get the right value.
@@ -126,7 +138,7 @@
if (ret != NULL) {
memset(ret, 0, size);
*dma_handle = virt_to_bus(ret);
- ret = KSEG0ADDR(ret);
+ ret = (void *)KSEG0ADDR(ret);
}
return ret;
}
@@ -134,7 +146,7 @@
static void dma_free(void *vaddr, size_t size)
{
- vaddr = KSEG0ADDR(vaddr);
+ vaddr = (void *)KSEG0ADDR(vaddr);
free_pages((unsigned long) vaddr, get_order(size));
}
@@ -211,7 +223,7 @@
struct au1k_private *aup = NULL;
int i, retval = 0, err;
db_dest_t *pDB, *pDBfree;
- unsigned long temp;
+ dma_addr_t temp;
dev->priv = kmalloc(sizeof(struct au1k_private), GFP_KERNEL);
if (dev->priv == NULL) {
@@ -292,6 +304,14 @@
aup->tx_ring[i]->flags = 0;
aup->tx_db_inuse[i] = pDB;
}
+
+#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+ /* power on */
+ bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
+ bcsr->resets |= BCSR_RESETS_IRDA_MODE_FULL;
+ au_sync();
+#endif
+
return 0;
out:
@@ -532,13 +552,13 @@
flags = ptxd->flags;
if (flags & AU_OWN) {
- printk(KERN_INFO "%s: tx_full\n", dev->name);
+ printk(KERN_DEBUG "%s: tx_full\n", dev->name);
netif_stop_queue(dev);
aup->tx_full = 1;
return 1;
}
else if (((aup->tx_head + 1) & (NUM_IR_DESC - 1)) == aup->tx_tail) {
- printk(KERN_INFO "%s: tx_full\n", dev->name);
+ printk(KERN_DEBUG "%s: tx_full\n", dev->name);
netif_stop_queue(dev);
aup->tx_full = 1;
return 1;
@@ -558,6 +578,7 @@
memcpy((void *)pDB->vaddr, skb->data, skb->len);
ptxd->count_0 = skb->len & 0xff;
ptxd->count_1 = (skb->len >> 8) & 0xff;
+
}
else {
/* SIR */
@@ -565,6 +586,7 @@
ptxd->count_0 = len & 0xff;
ptxd->count_1 = (len >> 8) & 0xff;
ptxd->flags |= IR_DIS_CRC;
+ au_writel(au_readl(0xae00000c) & ~(1<<13), 0xae00000c);
}
ptxd->flags |= AU_OWN;
au_sync();
@@ -699,12 +721,14 @@
u32 control;
int ret = 0, timeout = 10, i;
volatile ring_dest_t *ptxd;
+#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+ unsigned long irda_resets;
+#endif
if (speed == aup->speed)
return ret;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&ir_lock, flags);
/* disable PHY first */
writel(read_ir_reg(IR_ENABLE) & ~0x8000, IR_ENABLE);
@@ -745,10 +769,20 @@
ptxd->flags = AU_OWN;
}
- if (speed == 4000000)
+ if (speed == 4000000) {
+#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+ bcsr->resets |= BCSR_RESETS_FIR_SEL;
+#else /* Pb1000 and Pb1100 */
writel(1<<13, CPLD_AUX1);
- else
+#endif
+ }
+ else {
+#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
+ bcsr->resets &= ~BCSR_RESETS_FIR_SEL;
+#else /* Pb1000 and Pb1100 */
writel(readl(CPLD_AUX1) & ~(1<<13), CPLD_AUX1);
+#endif
+ }
switch (speed) {
case 9600:
@@ -794,18 +828,18 @@
}
else {
if (control & (1<<11))
- printk(KERN_INFO "%s Valid SIR config\n", dev->name);
+ printk(KERN_DEBUG "%s Valid SIR config\n", dev->name);
if (control & (1<<12))
- printk(KERN_INFO "%s Valid MIR config\n", dev->name);
+ printk(KERN_DEBUG "%s Valid MIR config\n", dev->name);
if (control & (1<<13))
- printk(KERN_INFO "%s Valid FIR config\n", dev->name);
+ printk(KERN_DEBUG "%s Valid FIR config\n", dev->name);
if (control & (1<<10))
- printk(KERN_INFO "%s TX enabled\n", dev->name);
+ printk(KERN_DEBUG "%s TX enabled\n", dev->name);
if (control & (1<<9))
- printk(KERN_INFO "%s RX enabled\n", dev->name);
+ printk(KERN_DEBUG "%s RX enabled\n", dev->name);
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&ir_lock, flags);
return ret;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)