[PATCH] smsc-ircc2: formatting fixes
IRDA: smsc-ircc2 - some formatting changes for better readability. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Cc: Jean Tourrilhes <jt@hpl.hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
527b6af413
commit
98b7777331
@@ -68,6 +68,36 @@
|
|||||||
#include "smsc-ircc2.h"
|
#include "smsc-ircc2.h"
|
||||||
#include "smsc-sio.h"
|
#include "smsc-sio.h"
|
||||||
|
|
||||||
|
|
||||||
|
MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
|
||||||
|
MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
|
||||||
|
static int ircc_dma = 255;
|
||||||
|
module_param(ircc_dma, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_dma, "DMA channel");
|
||||||
|
|
||||||
|
static int ircc_irq = 255;
|
||||||
|
module_param(ircc_irq, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_irq, "IRQ line");
|
||||||
|
|
||||||
|
static int ircc_fir;
|
||||||
|
module_param(ircc_fir, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_fir, "FIR Base Address");
|
||||||
|
|
||||||
|
static int ircc_sir;
|
||||||
|
module_param(ircc_sir, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_sir, "SIR Base Address");
|
||||||
|
|
||||||
|
static int ircc_cfg;
|
||||||
|
module_param(ircc_cfg, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_cfg, "Configuration register base address");
|
||||||
|
|
||||||
|
static int ircc_transceiver;
|
||||||
|
module_param(ircc_transceiver, int, 0);
|
||||||
|
MODULE_PARM_DESC(ircc_transceiver, "Transceiver type");
|
||||||
|
|
||||||
/* Types */
|
/* Types */
|
||||||
|
|
||||||
struct smsc_transceiver {
|
struct smsc_transceiver {
|
||||||
@@ -294,15 +324,7 @@ static smsc_chip_address_t __initdata possible_addresses[]=
|
|||||||
/* Globals */
|
/* Globals */
|
||||||
|
|
||||||
static struct smsc_ircc_cb *dev_self[] = { NULL, NULL };
|
static struct smsc_ircc_cb *dev_self[] = { NULL, NULL };
|
||||||
|
static unsigned short dev_count;
|
||||||
static int ircc_irq=255;
|
|
||||||
static int ircc_dma=255;
|
|
||||||
static int ircc_fir=0;
|
|
||||||
static int ircc_sir=0;
|
|
||||||
static int ircc_cfg=0;
|
|
||||||
static int ircc_transceiver=0;
|
|
||||||
|
|
||||||
static unsigned short dev_count=0;
|
|
||||||
|
|
||||||
static inline void register_bank(int iobase, int bank)
|
static inline void register_bank(int iobase, int bank)
|
||||||
{
|
{
|
||||||
@@ -333,7 +355,7 @@ static int __init smsc_ircc_init(void)
|
|||||||
|
|
||||||
dev_count = 0;
|
dev_count = 0;
|
||||||
|
|
||||||
if ((ircc_fir>0)&&(ircc_sir>0)) {
|
if (ircc_fir > 0 && ircc_sir > 0) {
|
||||||
IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
|
IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
|
||||||
IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
|
IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
|
||||||
|
|
||||||
@@ -353,7 +375,8 @@ static int __init smsc_ircc_init(void)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(smsc_ircc_look_for_chips()>0) ret = 0;
|
if (smsc_ircc_look_for_chips() > 0)
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -444,9 +467,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
|
|||||||
self->rx_buff.data = self->rx_buff.head;
|
self->rx_buff.data = self->rx_buff.head;
|
||||||
|
|
||||||
smsc_ircc_setup_io(self, fir_base, sir_base, dma, irq);
|
smsc_ircc_setup_io(self, fir_base, sir_base, dma, irq);
|
||||||
|
|
||||||
smsc_ircc_setup_qos(self);
|
smsc_ircc_setup_qos(self);
|
||||||
|
|
||||||
smsc_ircc_init_chip(self);
|
smsc_ircc_init_chip(self);
|
||||||
|
|
||||||
if (ircc_transceiver > 0 &&
|
if (ircc_transceiver > 0 &&
|
||||||
@@ -469,6 +490,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
|
|||||||
IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
|
IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_out4:
|
err_out4:
|
||||||
dma_free_coherent(NULL, self->tx_buff.truesize,
|
dma_free_coherent(NULL, self->tx_buff.truesize,
|
||||||
self->tx_buff.head, self->tx_buff_dma);
|
self->tx_buff.head, self->tx_buff_dma);
|
||||||
@@ -529,6 +551,7 @@ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
|
|||||||
chip & 0x0f, version, fir_base, sir_base, dma, irq);
|
chip & 0x0f, version, fir_base, sir_base, dma, irq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out3:
|
out3:
|
||||||
release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT);
|
release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT);
|
||||||
out2:
|
out2:
|
||||||
@@ -566,8 +589,7 @@ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self,
|
|||||||
IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
|
IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
|
||||||
driver_name, chip_irq, irq);
|
driver_name, chip_irq, irq);
|
||||||
self->io.irq = irq;
|
self->io.irq = irq;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
self->io.irq = chip_irq;
|
self->io.irq = chip_irq;
|
||||||
|
|
||||||
if (dma < 255) {
|
if (dma < 255) {
|
||||||
@@ -575,8 +597,7 @@ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self,
|
|||||||
IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
|
IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
|
||||||
driver_name, chip_dma, dma);
|
driver_name, chip_dma, dma);
|
||||||
self->io.dma = dma;
|
self->io.dma = dma;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
self->io.dma = chip_dma;
|
self->io.dma = chip_dma;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -611,8 +632,8 @@ static void smsc_ircc_init_chip(struct smsc_ircc_cb *self)
|
|||||||
int iobase, ir_mode, ctrl, fast;
|
int iobase, ir_mode, ctrl, fast;
|
||||||
|
|
||||||
IRDA_ASSERT(self != NULL, return;);
|
IRDA_ASSERT(self != NULL, return;);
|
||||||
iobase = self->io.fir_base;
|
|
||||||
|
|
||||||
|
iobase = self->io.fir_base;
|
||||||
ir_mode = IRCC_CFGA_IRDA_SIR_A;
|
ir_mode = IRCC_CFGA_IRDA_SIR_A;
|
||||||
ctrl = 0;
|
ctrl = 0;
|
||||||
fast = 0;
|
fast = 0;
|
||||||
@@ -770,7 +791,7 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
|
|||||||
|
|
||||||
/* Check if we need to change the speed */
|
/* Check if we need to change the speed */
|
||||||
speed = irda_get_next_speed(skb);
|
speed = irda_get_next_speed(skb);
|
||||||
if ((speed != self->io.speed) && (speed != -1)) {
|
if (speed != self->io.speed && speed != -1) {
|
||||||
/* Check for empty frame */
|
/* Check for empty frame */
|
||||||
if (!skb->len) {
|
if (!skb->len) {
|
||||||
/*
|
/*
|
||||||
@@ -787,9 +808,8 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
|
|||||||
spin_unlock_irqrestore(&self->lock, flags);
|
spin_unlock_irqrestore(&self->lock, flags);
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
self->new_speed = speed;
|
|
||||||
}
|
}
|
||||||
|
self->new_speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init tx buffer */
|
/* Init tx buffer */
|
||||||
@@ -971,7 +991,8 @@ static void smsc_ircc_change_speed(void *priv, u32 speed)
|
|||||||
if (!last_speed_was_sir) speed = self->io.speed;
|
if (!last_speed_was_sir) speed = self->io.speed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(self->io.speed != speed) smsc_ircc_set_transceiver_for_speed(self, speed);
|
if (self->io.speed != speed)
|
||||||
|
smsc_ircc_set_transceiver_for_speed(self, speed);
|
||||||
|
|
||||||
self->io.speed = speed;
|
self->io.speed = speed;
|
||||||
|
|
||||||
@@ -981,8 +1002,7 @@ static void smsc_ircc_change_speed(void *priv, u32 speed)
|
|||||||
smsc_ircc_sir_start(self);
|
smsc_ircc_sir_start(self);
|
||||||
}
|
}
|
||||||
smsc_ircc_set_sir_speed(self, speed);
|
smsc_ircc_set_sir_speed(self, speed);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (last_speed_was_sir) {
|
if (last_speed_was_sir) {
|
||||||
#if SMSC_IRCC2_C_SIR_STOP
|
#if SMSC_IRCC2_C_SIR_STOP
|
||||||
smsc_ircc_sir_stop(self);
|
smsc_ircc_sir_stop(self);
|
||||||
@@ -1038,10 +1058,8 @@ void smsc_ircc_set_sir_speed(void *priv, __u32 speed)
|
|||||||
* almost 1,7 ms at 19200 bps. At speeds above that we can just forget
|
* almost 1,7 ms at 19200 bps. At speeds above that we can just forget
|
||||||
* about this timeout since it will always be fast enough.
|
* about this timeout since it will always be fast enough.
|
||||||
*/
|
*/
|
||||||
if (self->io.speed < 38400)
|
fcr |= self->io.speed < 38400 ?
|
||||||
fcr |= UART_FCR_TRIGGER_1;
|
UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14;
|
||||||
else
|
|
||||||
fcr |= UART_FCR_TRIGGER_14;
|
|
||||||
|
|
||||||
/* IrDA ports use 8N1 */
|
/* IrDA ports use 8N1 */
|
||||||
lcr = UART_LCR_WLEN8;
|
lcr = UART_LCR_WLEN8;
|
||||||
@@ -1086,7 +1104,7 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
|
|||||||
|
|
||||||
/* Check if we need to change the speed after this frame */
|
/* Check if we need to change the speed after this frame */
|
||||||
speed = irda_get_next_speed(skb);
|
speed = irda_get_next_speed(skb);
|
||||||
if ((speed != self->io.speed) && (speed != -1)) {
|
if (speed != self->io.speed && speed != -1) {
|
||||||
/* Check for empty frame */
|
/* Check for empty frame */
|
||||||
if (!skb->len) {
|
if (!skb->len) {
|
||||||
/* Note : you should make sure that speed changes
|
/* Note : you should make sure that speed changes
|
||||||
@@ -1096,7 +1114,8 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
|
|||||||
spin_unlock_irqrestore(&self->lock, flags);
|
spin_unlock_irqrestore(&self->lock, flags);
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
}
|
||||||
|
|
||||||
self->new_speed = speed;
|
self->new_speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,6 +1141,7 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
|
|||||||
/* Transmit frame */
|
/* Transmit frame */
|
||||||
smsc_ircc_dma_xmit(self, iobase, 0);
|
smsc_ircc_dma_xmit(self, iobase, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&self->lock, flags);
|
spin_unlock_irqrestore(&self->lock, flags);
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
|
|
||||||
@@ -1271,7 +1291,6 @@ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase)
|
|||||||
outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER);
|
outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER);
|
||||||
outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER);
|
outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER);
|
||||||
|
|
||||||
|
|
||||||
/* Enable receiver */
|
/* Enable receiver */
|
||||||
register_bank(iobase, 0);
|
register_bank(iobase, 0);
|
||||||
outb(IRCC_LCR_B_SCE_RECEIVE | IRCC_LCR_B_SIP_ENABLE,
|
outb(IRCC_LCR_B_SCE_RECEIVE | IRCC_LCR_B_SIP_ENABLE,
|
||||||
@@ -1309,24 +1328,24 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self, int iobase
|
|||||||
|
|
||||||
len = self->rx_buff.truesize - get_dma_residue(self->io.dma);
|
len = self->rx_buff.truesize - get_dma_residue(self->io.dma);
|
||||||
|
|
||||||
/* Look for errors
|
/* Look for errors */
|
||||||
*/
|
|
||||||
|
|
||||||
if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) {
|
if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) {
|
||||||
self->stats.rx_errors++;
|
self->stats.rx_errors++;
|
||||||
if(lsr & IRCC_LSR_FRAME_ERROR) self->stats.rx_frame_errors++;
|
if (lsr & IRCC_LSR_FRAME_ERROR)
|
||||||
if(lsr & IRCC_LSR_CRC_ERROR) self->stats.rx_crc_errors++;
|
self->stats.rx_frame_errors++;
|
||||||
if(lsr & IRCC_LSR_SIZE_ERROR) self->stats.rx_length_errors++;
|
if (lsr & IRCC_LSR_CRC_ERROR)
|
||||||
if(lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) self->stats.rx_length_errors++;
|
self->stats.rx_crc_errors++;
|
||||||
|
if (lsr & IRCC_LSR_SIZE_ERROR)
|
||||||
|
self->stats.rx_length_errors++;
|
||||||
|
if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN))
|
||||||
|
self->stats.rx_length_errors++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Remove CRC */
|
|
||||||
if (self->io.speed < 4000000)
|
|
||||||
len -= 2;
|
|
||||||
else
|
|
||||||
len -= 4;
|
|
||||||
|
|
||||||
if ((len < 2) || (len > 2050)) {
|
/* Remove CRC */
|
||||||
|
len -= self->io.speed < 4000000 ? 2 : 4;
|
||||||
|
|
||||||
|
if (len < 2 || len > 2050) {
|
||||||
IRDA_WARNING("%s(), bogus len=%d\n", __FUNCTION__, len);
|
IRDA_WARNING("%s(), bogus len=%d\n", __FUNCTION__, len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1624,9 +1643,7 @@ static int smsc_ircc_net_close(struct net_device *dev)
|
|||||||
self->irlap = NULL;
|
self->irlap = NULL;
|
||||||
|
|
||||||
free_irq(self->io.irq, dev);
|
free_irq(self->io.irq, dev);
|
||||||
|
|
||||||
disable_dma(self->io.dma);
|
disable_dma(self->io.dma);
|
||||||
|
|
||||||
free_dma(self->io.dma);
|
free_dma(self->io.dma);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1637,13 +1654,11 @@ static void smsc_ircc_suspend(struct smsc_ircc_cb *self)
|
|||||||
{
|
{
|
||||||
IRDA_MESSAGE("%s, Suspending\n", driver_name);
|
IRDA_MESSAGE("%s, Suspending\n", driver_name);
|
||||||
|
|
||||||
if (self->io.suspended)
|
if (!self->io.suspended) {
|
||||||
return;
|
|
||||||
|
|
||||||
smsc_ircc_net_close(self->netdev);
|
smsc_ircc_net_close(self->netdev);
|
||||||
|
|
||||||
self->io.suspended = 1;
|
self->io.suspended = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void smsc_ircc_wakeup(struct smsc_ircc_cb *self)
|
static void smsc_ircc_wakeup(struct smsc_ircc_cb *self)
|
||||||
{
|
{
|
||||||
@@ -1862,10 +1877,8 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
|
|||||||
* is discarded. This is needed for half duplex operation
|
* is discarded. This is needed for half duplex operation
|
||||||
*/
|
*/
|
||||||
fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR;
|
fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR;
|
||||||
if (self->io.speed < 38400)
|
fcr |= self->io.speed < 38400 ?
|
||||||
fcr |= UART_FCR_TRIGGER_1;
|
UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14;
|
||||||
else
|
|
||||||
fcr |= UART_FCR_TRIGGER_14;
|
|
||||||
|
|
||||||
outb(fcr, iobase + UART_FCR);
|
outb(fcr, iobase + UART_FCR);
|
||||||
|
|
||||||
@@ -1892,7 +1905,7 @@ static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fill FIFO with current frame */
|
/* Fill FIFO with current frame */
|
||||||
while ((fifo_size-- > 0) && (actual < len)) {
|
while (fifo_size-- > 0 && actual < len) {
|
||||||
/* Transmit next byte */
|
/* Transmit next byte */
|
||||||
outb(buf[actual], iobase + UART_TX);
|
outb(buf[actual], iobase + UART_TX);
|
||||||
actual++;
|
actual++;
|
||||||
@@ -1925,12 +1938,13 @@ static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self)
|
|||||||
IRDA_ASSERT(self != NULL, return;);
|
IRDA_ASSERT(self != NULL, return;);
|
||||||
|
|
||||||
for (i = 0; smsc_transceivers[i].name != NULL; i++)
|
for (i = 0; smsc_transceivers[i].name != NULL; i++)
|
||||||
if((*smsc_transceivers[i].probe)(self->io.fir_base)) {
|
if (smsc_transceivers[i].probe(self->io.fir_base)) {
|
||||||
IRDA_MESSAGE(" %s transceiver found\n",
|
IRDA_MESSAGE(" %s transceiver found\n",
|
||||||
smsc_transceivers[i].name);
|
smsc_transceivers[i].name);
|
||||||
self->transceiver= i + 1;
|
self->transceiver= i + 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRDA_MESSAGE("No transceiver found. Defaulting to %s\n",
|
IRDA_MESSAGE("No transceiver found. Defaulting to %s\n",
|
||||||
smsc_transceivers[SMSC_IRCC2_C_DEFAULT_TRANSCEIVER].name);
|
smsc_transceivers[SMSC_IRCC2_C_DEFAULT_TRANSCEIVER].name);
|
||||||
|
|
||||||
@@ -1949,7 +1963,8 @@ static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 s
|
|||||||
unsigned int trx;
|
unsigned int trx;
|
||||||
|
|
||||||
trx = self->transceiver;
|
trx = self->transceiver;
|
||||||
if(trx>0) (*smsc_transceivers[trx-1].set_for_speed)(self->io.fir_base, speed);
|
if (trx > 0)
|
||||||
|
smsc_transceivers[trx - 1].set_for_speed(self->io.fir_base, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1977,13 +1992,11 @@ static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 s
|
|||||||
|
|
||||||
static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
|
static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
|
||||||
{
|
{
|
||||||
int iobase;
|
int iobase = self->io.sir_base;
|
||||||
int count = SMSC_IRCC2_HW_TRANSMITTER_TIMEOUT_US;
|
int count = SMSC_IRCC2_HW_TRANSMITTER_TIMEOUT_US;
|
||||||
|
|
||||||
iobase = self->io.sir_base;
|
|
||||||
|
|
||||||
/* Calibrated busy loop */
|
/* Calibrated busy loop */
|
||||||
while((count-- > 0) && !(inb(iobase+UART_LSR) & UART_LSR_TEMT))
|
while (count-- > 0 && !(inb(iobase + UART_LSR) & UART_LSR_TEMT))
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
@@ -2012,21 +2025,23 @@ static int __init smsc_ircc_look_for_chips(void)
|
|||||||
|
|
||||||
if (address->type & SMSCSIO_TYPE_FDC) {
|
if (address->type & SMSCSIO_TYPE_FDC) {
|
||||||
type = "FDC";
|
type = "FDC";
|
||||||
if((address->type) & SMSCSIO_TYPE_FLAT) {
|
if (address->type & SMSCSIO_TYPE_FLAT)
|
||||||
if(!smsc_superio_flat(fdc_chips_flat,cfg_base, type)) found++;
|
if (!smsc_superio_flat(fdc_chips_flat, cfg_base, type))
|
||||||
}
|
found++;
|
||||||
if((address->type) & SMSCSIO_TYPE_PAGED) {
|
|
||||||
if(!smsc_superio_paged(fdc_chips_paged,cfg_base, type)) found++;
|
if (address->type & SMSCSIO_TYPE_PAGED)
|
||||||
}
|
if (!smsc_superio_paged(fdc_chips_paged, cfg_base, type))
|
||||||
|
found++;
|
||||||
}
|
}
|
||||||
if (address->type & SMSCSIO_TYPE_LPC) {
|
if (address->type & SMSCSIO_TYPE_LPC) {
|
||||||
type = "LPC";
|
type = "LPC";
|
||||||
if((address->type) & SMSCSIO_TYPE_FLAT) {
|
if (address->type & SMSCSIO_TYPE_FLAT)
|
||||||
if(!smsc_superio_flat(lpc_chips_flat,cfg_base,type)) found++;
|
if (!smsc_superio_flat(lpc_chips_flat, cfg_base, type))
|
||||||
}
|
found++;
|
||||||
if((address->type) & SMSCSIO_TYPE_PAGED) {
|
|
||||||
if(!smsc_superio_paged(lpc_chips_paged,cfg_base,"LPC")) found++;
|
if (address->type & SMSCSIO_TYPE_PAGED)
|
||||||
}
|
if (!smsc_superio_paged(lpc_chips_paged, cfg_base, type))
|
||||||
|
found++;
|
||||||
}
|
}
|
||||||
address++;
|
address++;
|
||||||
}
|
}
|
||||||
@@ -2075,10 +2090,8 @@ static int __init smsc_superio_flat(const smsc_chip_t *chips, unsigned short cfg
|
|||||||
|
|
||||||
IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __FUNCTION__, firbase, sirbase, dma, irq, mode);
|
IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __FUNCTION__, firbase, sirbase, dma, irq, mode);
|
||||||
|
|
||||||
if (firbase) {
|
if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0)
|
||||||
if (smsc_ircc_open(firbase, sirbase, dma, irq) == 0)
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/* Exit configuration */
|
/* Exit configuration */
|
||||||
outb(SMSCSIO_CFGEXITKEY, cfgbase);
|
outb(SMSCSIO_CFGEXITKEY, cfgbase);
|
||||||
@@ -2119,10 +2132,8 @@ static int __init smsc_superio_paged(const smsc_chip_t *chips, unsigned short cf
|
|||||||
fir_io |= inb(cfg_base + 1);
|
fir_io |= inb(cfg_base + 1);
|
||||||
outb(0x2b, cfg_base); /* ??? */
|
outb(0x2b, cfg_base); /* ??? */
|
||||||
|
|
||||||
if (fir_io) {
|
if (fir_io && smsc_ircc_open(fir_io, sir_io, ircc_dma, ircc_irq) == 0)
|
||||||
if (smsc_ircc_open(fir_io, sir_io, ircc_dma, ircc_irq) == 0)
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/* Exit configuration */
|
/* Exit configuration */
|
||||||
outb(SMSCSIO_CFGEXITKEY, cfg_base);
|
outb(SMSCSIO_CFGEXITKEY, cfg_base);
|
||||||
@@ -2136,11 +2147,7 @@ static int __init smsc_access(unsigned short cfg_base,unsigned char reg)
|
|||||||
IRDA_DEBUG(1, "%s\n", __FUNCTION__);
|
IRDA_DEBUG(1, "%s\n", __FUNCTION__);
|
||||||
|
|
||||||
outb(reg, cfg_base);
|
outb(reg, cfg_base);
|
||||||
|
return inb(cfg_base) != reg ? -1 : 0;
|
||||||
if (inb(cfg_base)!=reg)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const smsc_chip_t * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const smsc_chip_t *chip, char *type)
|
static const smsc_chip_t * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const smsc_chip_t *chip, char *type)
|
||||||
@@ -2176,10 +2183,7 @@ static const smsc_chip_t * __init smsc_ircc_probe(unsigned short cfg_base,u8 reg
|
|||||||
|
|
||||||
devid = inb(cfg_base + 1);
|
devid = inb(cfg_base + 1);
|
||||||
|
|
||||||
if (devid==0) /* typical value for unused port */
|
if (devid == 0 || devid == 0xff) /* typical values for unused port */
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (devid==0xff) /* typical value for unused port */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* probe revision ID */
|
/* probe revision ID */
|
||||||
@@ -2205,7 +2209,8 @@ static const smsc_chip_t * __init smsc_ircc_probe(unsigned short cfg_base,u8 reg
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRDA_MESSAGE("found SMC SuperIO Chip (devid=0x%02x rev=%02X base=0x%04x): %s%s\n",devid,rev,cfg_base,type,chip->name);
|
IRDA_MESSAGE("found SMC SuperIO Chip (devid=0x%02x rev=%02X base=0x%04x): %s%s\n",
|
||||||
|
devid, rev, cfg_base, type, chip->name);
|
||||||
|
|
||||||
if (chip->rev > rev) {
|
if (chip->rev > rev) {
|
||||||
IRDA_MESSAGE("Revision higher than expected\n");
|
IRDA_MESSAGE("Revision higher than expected\n");
|
||||||
@@ -2226,8 +2231,8 @@ static int __init smsc_superio_fdc(unsigned short cfg_base)
|
|||||||
IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
|
IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
|
||||||
__FUNCTION__, cfg_base);
|
__FUNCTION__, cfg_base);
|
||||||
} else {
|
} else {
|
||||||
if (!smsc_superio_flat(fdc_chips_flat,cfg_base,"FDC")
|
if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") ||
|
||||||
||!smsc_superio_paged(fdc_chips_paged,cfg_base,"FDC"))
|
!smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC"))
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
release_region(cfg_base, 2);
|
release_region(cfg_base, 2);
|
||||||
@@ -2244,9 +2249,10 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
|
|||||||
IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
|
IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
|
||||||
__FUNCTION__, cfg_base);
|
__FUNCTION__, cfg_base);
|
||||||
} else {
|
} else {
|
||||||
if (!smsc_superio_flat(lpc_chips_flat,cfg_base,"LPC")
|
if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") ||
|
||||||
||!smsc_superio_paged(lpc_chips_paged,cfg_base,"LPC"))
|
!smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC"))
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
release_region(cfg_base, 2);
|
release_region(cfg_base, 2);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2276,8 +2282,13 @@ static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed)
|
|||||||
|
|
||||||
/* ATC */
|
/* ATC */
|
||||||
register_bank(fir_base, 4);
|
register_bank(fir_base, 4);
|
||||||
outb((inb(fir_base+IRCC_ATC) & IRCC_ATC_MASK) |IRCC_ATC_nPROGREADY|IRCC_ATC_ENABLE, fir_base+IRCC_ATC);
|
outb((inb(fir_base + IRCC_ATC) & IRCC_ATC_MASK) | IRCC_ATC_nPROGREADY|IRCC_ATC_ENABLE,
|
||||||
while((val=(inb(fir_base+IRCC_ATC) & IRCC_ATC_nPROGREADY)) && !time_after(jiffies, jiffies_timeout));
|
fir_base + IRCC_ATC);
|
||||||
|
|
||||||
|
while ((val = (inb(fir_base + IRCC_ATC) & IRCC_ATC_nPROGREADY)) &&
|
||||||
|
!time_after(jiffies, jiffies_timeout))
|
||||||
|
/* empty */;
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
IRDA_WARNING("%s(): ATC: 0x%02x\n", __FUNCTION__,
|
IRDA_WARNING("%s(): ATC: 0x%02x\n", __FUNCTION__,
|
||||||
inb(fir_base + IRCC_ATC));
|
inb(fir_base + IRCC_ATC));
|
||||||
@@ -2306,8 +2317,7 @@ static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u3
|
|||||||
{
|
{
|
||||||
u8 fast_mode;
|
u8 fast_mode;
|
||||||
|
|
||||||
switch(speed)
|
switch (speed) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
case 576000 :
|
case 576000 :
|
||||||
fast_mode = 0;
|
fast_mode = 0;
|
||||||
@@ -2316,7 +2326,6 @@ static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u3
|
|||||||
case 4000000 :
|
case 4000000 :
|
||||||
fast_mode = IRCC_LCR_A_FAST;
|
fast_mode = IRCC_LCR_A_FAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
register_bank(fir_base, 0);
|
register_bank(fir_base, 0);
|
||||||
outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A);
|
outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A);
|
||||||
@@ -2345,8 +2354,7 @@ static void smsc_ircc_set_transceiver_toshiba_sat1800(int fir_base, u32 speed)
|
|||||||
{
|
{
|
||||||
u8 fast_mode;
|
u8 fast_mode;
|
||||||
|
|
||||||
switch(speed)
|
switch (speed) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
case 576000 :
|
case 576000 :
|
||||||
fast_mode = 0;
|
fast_mode = 0;
|
||||||
@@ -2377,20 +2385,3 @@ static int smsc_ircc_probe_transceiver_toshiba_sat1800(int fir_base)
|
|||||||
|
|
||||||
module_init(smsc_ircc_init);
|
module_init(smsc_ircc_init);
|
||||||
module_exit(smsc_ircc_cleanup);
|
module_exit(smsc_ircc_cleanup);
|
||||||
|
|
||||||
MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
|
|
||||||
MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
|
|
||||||
MODULE_LICENSE("GPL");
|
|
||||||
|
|
||||||
module_param(ircc_dma, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_dma, "DMA channel");
|
|
||||||
module_param(ircc_irq, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_irq, "IRQ line");
|
|
||||||
module_param(ircc_fir, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_fir, "FIR Base Address");
|
|
||||||
module_param(ircc_sir, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_sir, "SIR Base Address");
|
|
||||||
module_param(ircc_cfg, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_cfg, "Configuration register base address");
|
|
||||||
module_param(ircc_transceiver, int, 0);
|
|
||||||
MODULE_PARM_DESC(ircc_transceiver, "Transceiver type");
|
|
||||||
|
Reference in New Issue
Block a user