Commit 01de90d7 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/disk1/davem/BK/irda-2.6

into kernel.bkbits.net:/home/davem/irda-2.6
parents 62e19824 aff55ff2
...@@ -65,6 +65,75 @@ config TEKRAM_DONGLE ...@@ -65,6 +65,75 @@ config TEKRAM_DONGLE
dongles you will have to start irattach like this: dongles you will have to start irattach like this:
"irattach -d tekram". "irattach -d tekram".
config LITELINK_DONGLE
tristate "Parallax LiteLink dongle"
depends on DONGLE && IRDA
help
Say Y here if you want to build support for the Parallax Litelink
dongle. To compile it as a module, choose M here. The Parallax
dongle attaches to the normal 9-pin serial port connector, and can
currently only be used by IrTTY. To activate support for Parallax
dongles you will have to start irattach like this:
"irattach -d litelink".
config MA600_DONGLE
tristate "Mobile Action MA600 dongle"
depends on DONGLE && IRDA && EXPERIMENTAL
help
Say Y here if you want to build support for the Mobile Action MA600
dongle. To compile it as a module, choose M here. The MA600 dongle
attaches to the normal 9-pin serial port connector, and can
currently only be used by IrTTY. The driver should also support
the MA620 USB version of the dongle, if the integrated USB-to-RS232
converter is supported by usbserial. To activate support for
MA600 dongle you will have to start irattach like this:
"irattach -d ma600".
config GIRBIL_DONGLE
tristate "Greenwich GIrBIL dongle"
depends on DONGLE && IRDA && EXPERIMENTAL
help
Say Y here if you want to build support for the Greenwich GIrBIL
dongle. If you want to compile it as a module, choose M here.
The Greenwich dongle attaches to the normal 9-pin serial port
connector, and can currently only be used by IrTTY. To activate
support for Greenwich dongles you will have to start irattach
like this: "irattach -d girbil".
config MCP2120_DONGLE
tristate "Microchip MCP2120"
depends on DONGLE && IRDA && EXPERIMENTAL
help
Say Y here if you want to build support for the Microchip MCP2120
dongle. If you want to compile it as a module, choose M here.
The MCP2120 dongle attaches to the normal 9-pin serial port
connector, and can currently only be used by IrTTY. To activate
support for MCP2120 dongles you will have to start irattach
like this: "irattach -d mcp2120".
You must build this dongle yourself. For more information see:
<http://www.eyetap.org/~tangf/irda_sir_linux.html>
config OLD_BELKIN_DONGLE
tristate "Old Belkin dongle"
depends on DONGLE && IRDA && EXPERIMENTAL
help
Say Y here if you want to build support for the Adaptec Airport 1000
and 2000 dongles. If you want to compile it as a module, choose
M here. Some information is contained in the comments
at the top of <file:drivers/net/irda/old_belkin.c>.
config ACT200L_DONGLE
tristate "ACTiSYS IR-200L dongle"
depends on DONGLE && IRDA && EXPERIMENTAL
help
Say Y here if you want to build support for the ACTiSYS IR-200L
dongle. If you want to compile it as a module, choose M here.
The ACTiSYS IR-200L dongle attaches to the normal 9-pin serial
port connector, and can currently only be used by IrTTY.
To activate support for ACTiSYS IR-200L dongle you will have to
start irattach like this: "irattach -d act200l".
comment "Old SIR device drivers" comment "Old SIR device drivers"
config IRPORT_SIR config IRPORT_SIR
...@@ -130,7 +199,7 @@ config TEKRAM_DONGLE_OLD ...@@ -130,7 +199,7 @@ config TEKRAM_DONGLE_OLD
dongles you will have to start irattach like this: dongles you will have to start irattach like this:
"irattach -d tekram". "irattach -d tekram".
config GIRBIL_DONGLE config GIRBIL_DONGLE_OLD
tristate "Greenwich GIrBIL dongle" tristate "Greenwich GIrBIL dongle"
depends on DONGLE_OLD && IRDA depends on DONGLE_OLD && IRDA
help help
...@@ -141,7 +210,7 @@ config GIRBIL_DONGLE ...@@ -141,7 +210,7 @@ config GIRBIL_DONGLE
dongles you will have to insert "irattach -d girbil" in the dongles you will have to insert "irattach -d girbil" in the
/etc/irda/drivers script. /etc/irda/drivers script.
config LITELINK_DONGLE config LITELINK_DONGLE_OLD
tristate "Parallax LiteLink dongle" tristate "Parallax LiteLink dongle"
depends on DONGLE_OLD && IRDA depends on DONGLE_OLD && IRDA
help help
...@@ -152,7 +221,7 @@ config LITELINK_DONGLE ...@@ -152,7 +221,7 @@ config LITELINK_DONGLE
dongles you will have to start irattach like this: dongles you will have to start irattach like this:
"irattach -d litelink". "irattach -d litelink".
config MCP2120_DONGLE config MCP2120_DONGLE_OLD
tristate "Microchip MCP2120" tristate "Microchip MCP2120"
depends on DONGLE_OLD && IRDA depends on DONGLE_OLD && IRDA
help help
...@@ -166,7 +235,7 @@ config MCP2120_DONGLE ...@@ -166,7 +235,7 @@ config MCP2120_DONGLE
You must build this dongle yourself. For more information see: You must build this dongle yourself. For more information see:
<http://www.eyetap.org/~tangf/irda_sir_linux.html> <http://www.eyetap.org/~tangf/irda_sir_linux.html>
config OLD_BELKIN_DONGLE config OLD_BELKIN_DONGLE_OLD
tristate "Old Belkin dongle" tristate "Old Belkin dongle"
depends on DONGLE_OLD && IRDA depends on DONGLE_OLD && IRDA
help help
...@@ -175,11 +244,7 @@ config OLD_BELKIN_DONGLE ...@@ -175,11 +244,7 @@ config OLD_BELKIN_DONGLE
will be called old_belkin. Some information is contained in the will be called old_belkin. Some information is contained in the
comments at the top of <file:drivers/net/irda/old_belkin.c>. comments at the top of <file:drivers/net/irda/old_belkin.c>.
config EP7211_IR config ACT200L_DONGLE_OLD
tristate "EP7211 I/R support"
depends on DONGLE_OLD && ARCH_EP7211 && IRDA
config ACT200L_DONGLE
tristate "ACTiSYS IR-200L dongle (EXPERIMENTAL)" tristate "ACTiSYS IR-200L dongle (EXPERIMENTAL)"
depends on DONGLE_OLD && EXPERIMENTAL && IRDA depends on DONGLE_OLD && EXPERIMENTAL && IRDA
help help
...@@ -190,7 +255,7 @@ config ACT200L_DONGLE ...@@ -190,7 +255,7 @@ config ACT200L_DONGLE
ACTiSYS IR-200L dongles you will have to start irattach like this: ACTiSYS IR-200L dongles you will have to start irattach like this:
"irattach -d act200l". "irattach -d act200l".
config MA600_DONGLE config MA600_DONGLE_OLD
tristate "Mobile Action MA600 dongle (EXPERIMENTAL)" tristate "Mobile Action MA600 dongle (EXPERIMENTAL)"
depends on DONGLE_OLD && EXPERIMENTAL && IRDA depends on DONGLE_OLD && EXPERIMENTAL && IRDA
---help--- ---help---
...@@ -206,6 +271,10 @@ config MA600_DONGLE ...@@ -206,6 +271,10 @@ config MA600_DONGLE
There is a pre-compiled module on There is a pre-compiled module on
<http://engsvr.ust.hk/~eetwl95/download/ma600-2.4.x.tar.gz> <http://engsvr.ust.hk/~eetwl95/download/ma600-2.4.x.tar.gz>
config EP7211_IR
tristate "EP7211 I/R support"
depends on DONGLE_OLD && ARCH_EP7211 && IRDA
comment "FIR device drivers" comment "FIR device drivers"
config USB_IRDA config USB_IRDA
......
...@@ -21,20 +21,26 @@ obj-$(CONFIG_VIA_FIR) += via-ircc.o ...@@ -21,20 +21,26 @@ obj-$(CONFIG_VIA_FIR) += via-ircc.o
obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o
obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o
obj-$(CONFIG_ACTISYS_DONGLE_OLD) += actisys.o obj-$(CONFIG_ACTISYS_DONGLE_OLD) += actisys.o
obj-$(CONFIG_GIRBIL_DONGLE) += girbil.o obj-$(CONFIG_GIRBIL_DONGLE_OLD) += girbil.o
obj-$(CONFIG_LITELINK_DONGLE) += litelink.o obj-$(CONFIG_LITELINK_DONGLE_OLD) += litelink.o
obj-$(CONFIG_OLD_BELKIN_DONGLE) += old_belkin.o obj-$(CONFIG_OLD_BELKIN_DONGLE_OLD) += old_belkin.o
obj-$(CONFIG_MCP2120_DONGLE_OLD) += mcp2120.o
obj-$(CONFIG_ACT200L_DONGLE_OLD) += act200l.o
obj-$(CONFIG_MA600_DONGLE_OLD) += ma600.o
obj-$(CONFIG_EP7211_IR) += ep7211_ir.o obj-$(CONFIG_EP7211_IR) += ep7211_ir.o
obj-$(CONFIG_MCP2120_DONGLE) += mcp2120.o
obj-$(CONFIG_AU1000_FIR) += au1k_ir.o obj-$(CONFIG_AU1000_FIR) += au1k_ir.o
obj-$(CONFIG_ACT200L_DONGLE) += act200l.o
obj-$(CONFIG_MA600_DONGLE) += ma600.o
# New SIR drivers # New SIR drivers
obj-$(CONFIG_IRTTY_SIR) += irtty-sir.o sir-dev.o obj-$(CONFIG_IRTTY_SIR) += irtty-sir.o sir-dev.o
# New dongles drivers for new SIR drivers # New dongles drivers for new SIR drivers
obj-$(CONFIG_ESI_DONGLE) += esi-sir.o obj-$(CONFIG_ESI_DONGLE) += esi-sir.o
obj-$(CONFIG_TEKRAM_DONGLE) += tekram-sir.o obj-$(CONFIG_TEKRAM_DONGLE) += tekram-sir.o
obj-$(CONFIG_ACTISYS_DONGLE) += actisys-sir.o obj-$(CONFIG_ACTISYS_DONGLE) += actisys-sir.o
obj-$(CONFIG_LITELINK_DONGLE) += litelink-sir.o
obj-$(CONFIG_GIRBIL_DONGLE) += girbil-sir.o
obj-$(CONFIG_OLD_BELKIN_DONGLE) += old_belkin-sir.o
obj-$(CONFIG_MCP2120_DONGLE) += mcp2120-sir.o
obj-$(CONFIG_ACT200L_DONGLE) += act200l-sir.o
obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o
# The SIR helper module # The SIR helper module
sir-dev-objs := sir_core.o sir_dev.o sir_dongle.o sir_kthread.o sir-dev-objs := sir_core.o sir_dev.o sir_dongle.o sir_kthread.o
/*********************************************************************
*
* Filename: act200l.c
* Version: 0.8
* Description: Implementation for the ACTiSYS ACT-IR200L dongle
* Status: Experimental.
* Author: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>
* Created at: Fri Aug 3 17:35:42 2001
* Modified at: Fri Aug 17 10:22:40 2001
* Modified by: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>
*
* Copyright (c) 2001 SHIMIZU Takuya, All Rights Reserved.
*
* 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.
*
********************************************************************/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
static int act200l_reset(struct sir_dev *dev);
static int act200l_open(struct sir_dev *dev);
static int act200l_close(struct sir_dev *dev);
static int act200l_change_speed(struct sir_dev *dev, unsigned speed);
/* Regsiter 0: Control register #1 */
#define ACT200L_REG0 0x00
#define ACT200L_TXEN 0x01 /* Enable transmitter */
#define ACT200L_RXEN 0x02 /* Enable receiver */
/* Register 1: Control register #2 */
#define ACT200L_REG1 0x10
#define ACT200L_LODB 0x01 /* Load new baud rate count value */
#define ACT200L_WIDE 0x04 /* Expand the maximum allowable pulse */
/* Register 4: Output Power register */
#define ACT200L_REG4 0x40
#define ACT200L_OP0 0x01 /* Enable LED1C output */
#define ACT200L_OP1 0x02 /* Enable LED2C output */
#define ACT200L_BLKR 0x04
/* Register 5: Receive Mode register */
#define ACT200L_REG5 0x50
#define ACT200L_RWIDL 0x01 /* fixed 1.6us pulse mode */
/* Register 6: Receive Sensitivity register #1 */
#define ACT200L_REG6 0x60
#define ACT200L_RS0 0x01 /* receive threshold bit 0 */
#define ACT200L_RS1 0x02 /* receive threshold bit 1 */
/* Register 7: Receive Sensitivity register #2 */
#define ACT200L_REG7 0x70
#define ACT200L_ENPOS 0x04 /* Ignore the falling edge */
/* Register 8,9: Baud Rate Dvider register #1,#2 */
#define ACT200L_REG8 0x80
#define ACT200L_REG9 0x90
#define ACT200L_2400 0x5f
#define ACT200L_9600 0x17
#define ACT200L_19200 0x0b
#define ACT200L_38400 0x05
#define ACT200L_57600 0x03
#define ACT200L_115200 0x01
/* Register 13: Control register #3 */
#define ACT200L_REG13 0xd0
#define ACT200L_SHDW 0x01 /* Enable access to shadow registers */
/* Register 15: Status register */
#define ACT200L_REG15 0xf0
/* Register 21: Control register #4 */
#define ACT200L_REG21 0x50
#define ACT200L_EXCK 0x02 /* Disable clock output driver */
#define ACT200L_OSCL 0x04 /* oscillator in low power, medium accuracy mode */
static struct dongle_driver act200l = {
.owner = THIS_MODULE,
.driver_name = "ACTiSYS ACT-IR200L",
.type = IRDA_ACT200L_DONGLE,
.open = act200l_open,
.close = act200l_close,
.reset = act200l_reset,
.set_speed = act200l_change_speed,
};
int __init act200l_init(void)
{
return irda_register_dongle(&act200l);
}
void __exit act200l_cleanup(void)
{
irda_unregister_dongle(&act200l);
}
static int act200l_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
/* Power on the dongle */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Set the speeds we can accept */
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits = 0x03;
irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0;
}
static int act200l_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
/* Power off the dongle */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
/*
* Function act200l_change_speed (dev, speed)
*
* Set the speed for the ACTiSYS ACT-IR200L type dongle.
*
*/
static int act200l_change_speed(struct sir_dev *dev, unsigned speed)
{
u8 control[3];
int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
/* Clear DTR and set RTS to enter command mode */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
switch (speed) {
default:
ret = -EINVAL;
/* fall through */
case 9600:
control[0] = ACT200L_REG8 | (ACT200L_9600 & 0x0f);
control[1] = ACT200L_REG9 | ((ACT200L_9600 >> 4) & 0x0f);
break;
case 19200:
control[0] = ACT200L_REG8 | (ACT200L_19200 & 0x0f);
control[1] = ACT200L_REG9 | ((ACT200L_19200 >> 4) & 0x0f);
break;
case 38400:
control[0] = ACT200L_REG8 | (ACT200L_38400 & 0x0f);
control[1] = ACT200L_REG9 | ((ACT200L_38400 >> 4) & 0x0f);
break;
case 57600:
control[0] = ACT200L_REG8 | (ACT200L_57600 & 0x0f);
control[1] = ACT200L_REG9 | ((ACT200L_57600 >> 4) & 0x0f);
break;
case 115200:
control[0] = ACT200L_REG8 | (ACT200L_115200 & 0x0f);
control[1] = ACT200L_REG9 | ((ACT200L_115200 >> 4) & 0x0f);
break;
}
control[2] = ACT200L_REG1 | ACT200L_LODB | ACT200L_WIDE;
/* Write control bytes */
sirdev_raw_write(dev, control, 3);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(5));
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
dev->speed = speed;
return ret;
}
/*
* Function act200l_reset (driver)
*
* Reset the ACTiSYS ACT-IR200L type dongle.
*/
#define ACT200L_STATE_WAIT1_RESET (SIRDEV_STATE_DONGLE_RESET+1)
#define ACT200L_STATE_WAIT2_RESET (SIRDEV_STATE_DONGLE_RESET+2)
static int act200l_reset(struct sir_dev *dev)
{
unsigned state = dev->fsm.substate;
unsigned delay = 0;
u8 control[9] = {
ACT200L_REG15,
ACT200L_REG13 | ACT200L_SHDW,
ACT200L_REG21 | ACT200L_EXCK | ACT200L_OSCL,
ACT200L_REG13,
ACT200L_REG7 | ACT200L_ENPOS,
ACT200L_REG6 | ACT200L_RS0 | ACT200L_RS1,
ACT200L_REG5 | ACT200L_RWIDL,
ACT200L_REG4 | ACT200L_OP0 | ACT200L_OP1 | ACT200L_BLKR,
ACT200L_REG0 | ACT200L_TXEN | ACT200L_RXEN
};
int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
switch (state) {
case SIRDEV_STATE_DONGLE_RESET:
/* Reset the dongle : set RTS low for 25 ms */
sirdev_set_dtr_rts(dev, TRUE, FALSE);
state = ACT200L_STATE_WAIT1_RESET;
delay = 50;
break;
case ACT200L_STATE_WAIT1_RESET:
/* Clear DTR and set RTS to enter command mode */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
udelay(25); /* better wait for some short while */
/* Write control bytes */
sirdev_raw_write(dev, control, sizeof(control));
state = ACT200L_STATE_WAIT2_RESET;
delay = 15;
break;
case ACT200L_STATE_WAIT2_RESET:
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
dev->speed = 9600;
break;
default:
ERROR("%s(), unknown state %d\n", __FUNCTION__, state);
ret = -1;
break;
}
dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
}
MODULE_AUTHOR("SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>");
MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */
module_init(act200l_init);
module_exit(act200l_cleanup);
...@@ -65,7 +65,7 @@ static int actisys_reset(struct sir_dev *); ...@@ -65,7 +65,7 @@ static int actisys_reset(struct sir_dev *);
/* These are the baudrates supported, in the order available */ /* These are the baudrates supported, in the order available */
/* Note : the 220L doesn't support 38400, but we will fix that below */ /* Note : the 220L doesn't support 38400, but we will fix that below */
static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400 }; static unsigned baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) #define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0]))
...@@ -118,7 +118,7 @@ static int actisys_open(struct sir_dev *dev) ...@@ -118,7 +118,7 @@ static int actisys_open(struct sir_dev *dev)
{ {
struct qos_info *qos = &dev->qos; struct qos_info *qos = &dev->qos;
dev->set_dtr_rts(dev, TRUE, TRUE); sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Set the speeds we can accept */ /* Set the speeds we can accept */
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
...@@ -130,13 +130,15 @@ static int actisys_open(struct sir_dev *dev) ...@@ -130,13 +130,15 @@ static int actisys_open(struct sir_dev *dev)
qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */ qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */
irda_qos_bits_to_value(qos); irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0; return 0;
} }
static int actisys_close(struct sir_dev *dev) static int actisys_close(struct sir_dev *dev)
{ {
/* Power off the dongle */ /* Power off the dongle */
dev->set_dtr_rts(dev, FALSE, FALSE); sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0; return 0;
} }
...@@ -174,23 +176,25 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -174,23 +176,25 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed)
* Now, we can set the speed requested. Send RTS pulses until we * Now, we can set the speed requested. Send RTS pulses until we
* reach the target speed * reach the target speed
*/ */
for (i=0; i<MAX_SPEEDS; i++) { for (i = 0; i < MAX_SPEEDS; i++) {
if (speed == baud_rates[i]) { if (speed == baud_rates[i]) {
dev->speed = baud_rates[i]; dev->speed = speed;
break; break;
} }
/* Set RTS low for 10 us */ /* Set RTS low for 10 us */
dev->set_dtr_rts(dev, TRUE, FALSE); sirdev_set_dtr_rts(dev, TRUE, FALSE);
udelay(MIN_DELAY); udelay(MIN_DELAY);
/* Set RTS high for 10 us */ /* Set RTS high for 10 us */
dev->set_dtr_rts(dev, TRUE, TRUE); sirdev_set_dtr_rts(dev, TRUE, TRUE);
udelay(MIN_DELAY); udelay(MIN_DELAY);
} }
/* Check if life is sweet... */ /* Check if life is sweet... */
if (i >= MAX_SPEEDS) if (i >= MAX_SPEEDS) {
ret = -1; /* This should not happen */ actisys_reset(dev);
ret = -EINVAL; /* This should not happen */
}
/* Basta lavoro, on se casse d'ici... */ /* Basta lavoro, on se casse d'ici... */
return ret; return ret;
...@@ -221,11 +225,11 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -221,11 +225,11 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed)
static int actisys_reset(struct sir_dev *dev) static int actisys_reset(struct sir_dev *dev)
{ {
/* Reset the dongle : set DTR low for 10 us */ /* Reset the dongle : set DTR low for 10 us */
dev->set_dtr_rts(dev, FALSE, TRUE); sirdev_set_dtr_rts(dev, FALSE, TRUE);
udelay(MIN_DELAY); udelay(MIN_DELAY);
/* Go back to normal mode */ /* Go back to normal mode */
dev->set_dtr_rts(dev, TRUE, TRUE); sirdev_set_dtr_rts(dev, TRUE, TRUE);
dev->speed = 9600; /* That's the default */ dev->speed = 9600; /* That's the default */
......
...@@ -68,11 +68,14 @@ static int esi_open(struct sir_dev *dev) ...@@ -68,11 +68,14 @@ static int esi_open(struct sir_dev *dev)
{ {
struct qos_info *qos = &dev->qos; struct qos_info *qos = &dev->qos;
/* Power up and set dongle to 9600 baud */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200; qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
irda_qos_bits_to_value(qos); irda_qos_bits_to_value(qos);
/* shouldn't we do set_dtr_rts(FALSE, TRUE) here (power up at 9600)? */ /* irda thread waits 50 msec for power settling */
return 0; return 0;
} }
...@@ -80,7 +83,7 @@ static int esi_open(struct sir_dev *dev) ...@@ -80,7 +83,7 @@ static int esi_open(struct sir_dev *dev)
static int esi_close(struct sir_dev *dev) static int esi_close(struct sir_dev *dev)
{ {
/* Power off dongle */ /* Power off dongle */
dev->set_dtr_rts(dev, FALSE, FALSE); sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0; return 0;
} }
...@@ -88,11 +91,13 @@ static int esi_close(struct sir_dev *dev) ...@@ -88,11 +91,13 @@ static int esi_close(struct sir_dev *dev)
/* /*
* Function esi_change_speed (task) * Function esi_change_speed (task)
* *
* Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
* Apparently (see old esi-driver) no delays are needed here...
* *
*/ */
static int esi_change_speed(struct sir_dev *dev, unsigned speed) static int esi_change_speed(struct sir_dev *dev, unsigned speed)
{ {
int ret = 0;
int dtr, rts; int dtr, rts;
switch (speed) { switch (speed) {
...@@ -104,6 +109,7 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -104,6 +109,7 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed)
dtr = rts = TRUE; dtr = rts = TRUE;
break; break;
default: default:
ret = -EINVAL;
speed = 9600; speed = 9600;
/* fall through */ /* fall through */
case 9600: case 9600:
...@@ -113,12 +119,10 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -113,12 +119,10 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed)
} }
/* Change speed of dongle */ /* Change speed of dongle */
dev->set_dtr_rts(dev, dtr, rts); sirdev_set_dtr_rts(dev, dtr, rts);
dev->speed = speed; dev->speed = speed;
/* do we need some delay for power stabilization? */ return ret;
return 0;
} }
/* /*
...@@ -129,9 +133,18 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -129,9 +133,18 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed)
*/ */
static int esi_reset(struct sir_dev *dev) static int esi_reset(struct sir_dev *dev)
{ {
dev->set_dtr_rts(dev, FALSE, FALSE); sirdev_set_dtr_rts(dev, FALSE, FALSE);
/* Hm, probably repower to 9600 and some delays? */ /* Hm, the old esi-driver left the dongle unpowered relying on
* the following speed change to repower. This might work for
* the esi because we only need the modem lines. However, now the
* general rule is reset must bring the dongle to some working
* well-known state because speed change might write to registers.
* The old esi-driver didn't any delay here - let's hope it' fine.
*/
sirdev_set_dtr_rts(dev, FALSE, TRUE);
dev->speed = 9600;
return 0; return 0;
} }
......
/*********************************************************************
*
* Filename: girbil.c
* Version: 1.2
* Description: Implementation for the Greenwich GIrBIL dongle
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Feb 6 21:02:33 1999
* Modified at: Fri Dec 17 09:13:20 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
*
* 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.
*
* Neither Dag Brattli nor University of Troms admit liability nor
* provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
static int girbil_reset(struct sir_dev *dev);
static int girbil_open(struct sir_dev *dev);
static int girbil_close(struct sir_dev *dev);
static int girbil_change_speed(struct sir_dev *dev, unsigned speed);
/* Control register 1 */
#define GIRBIL_TXEN 0x01 /* Enable transmitter */
#define GIRBIL_RXEN 0x02 /* Enable receiver */
#define GIRBIL_ECAN 0x04 /* Cancel self emmited data */
#define GIRBIL_ECHO 0x08 /* Echo control characters */
/* LED Current Register (0x2) */
#define GIRBIL_HIGH 0x20
#define GIRBIL_MEDIUM 0x21
#define GIRBIL_LOW 0x22
/* Baud register (0x3) */
#define GIRBIL_2400 0x30
#define GIRBIL_4800 0x31
#define GIRBIL_9600 0x32
#define GIRBIL_19200 0x33
#define GIRBIL_38400 0x34
#define GIRBIL_57600 0x35
#define GIRBIL_115200 0x36
/* Mode register (0x4) */
#define GIRBIL_IRDA 0x40
#define GIRBIL_ASK 0x41
/* Control register 2 (0x5) */
#define GIRBIL_LOAD 0x51 /* Load the new baud rate value */
static struct dongle_driver girbil = {
.owner = THIS_MODULE,
.driver_name = "Greenwich GIrBIL",
.type = IRDA_GIRBIL_DONGLE,
.open = girbil_open,
.close = girbil_close,
.reset = girbil_reset,
.set_speed = girbil_change_speed,
};
int __init girbil_init(void)
{
return irda_register_dongle(&girbil);
}
void __exit girbil_cleanup(void)
{
irda_unregister_dongle(&girbil);
}
static int girbil_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power on dongle */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits = 0x03;
irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0;
}
static int girbil_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
/*
* Function girbil_change_speed (dev, speed)
*
* Set the speed for the Girbil type dongle.
*
*/
#define GIRBIL_STATE_WAIT_SPEED (SIRDEV_STATE_DONGLE_SPEED + 1)
static int girbil_change_speed(struct sir_dev *dev, unsigned speed)
{
unsigned state = dev->fsm.substate;
unsigned delay = 0;
u8 control[2];
static int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* dongle alread reset - port and dongle at default speed */
switch(state) {
case SIRDEV_STATE_DONGLE_SPEED:
/* Set DTR and Clear RTS to enter command mode */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
udelay(25); /* better wait a little while */
ret = 0;
switch (speed) {
default:
ret = -EINVAL;
/* fall through */
case 9600:
control[0] = GIRBIL_9600;
break;
case 19200:
control[0] = GIRBIL_19200;
break;
case 34800:
control[0] = GIRBIL_38400;
break;
case 57600:
control[0] = GIRBIL_57600;
break;
case 115200:
control[0] = GIRBIL_115200;
break;
}
control[1] = GIRBIL_LOAD;
/* Write control bytes */
sirdev_raw_write(dev, control, 2);
dev->speed = speed;
state = GIRBIL_STATE_WAIT_SPEED;
delay = 100;
break;
case GIRBIL_STATE_WAIT_SPEED:
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
udelay(25); /* better wait a little while */
break;
default:
ERROR("%s - undefined state %d\n", __FUNCTION__, state);
ret = -EINVAL;
break;
}
dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
}
/*
* Function girbil_reset (driver)
*
* This function resets the girbil dongle.
*
* Algorithm:
* 0. set RTS, and wait at least 5 ms
* 1. clear RTS
*/
#define GIRBIL_STATE_WAIT1_RESET (SIRDEV_STATE_DONGLE_RESET + 1)
#define GIRBIL_STATE_WAIT2_RESET (SIRDEV_STATE_DONGLE_RESET + 2)
#define GIRBIL_STATE_WAIT3_RESET (SIRDEV_STATE_DONGLE_RESET + 3)
static int girbil_reset(struct sir_dev *dev)
{
unsigned state = dev->fsm.substate;
unsigned delay = 0;
u8 control = GIRBIL_TXEN | GIRBIL_RXEN;
int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
switch (state) {
case SIRDEV_STATE_DONGLE_RESET:
/* Reset dongle */
sirdev_set_dtr_rts(dev, TRUE, FALSE);
/* Sleep at least 5 ms */
delay = 20;
state = GIRBIL_STATE_WAIT1_RESET;
break;
case GIRBIL_STATE_WAIT1_RESET:
/* Set DTR and clear RTS to enter command mode */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
delay = 20;
state = GIRBIL_STATE_WAIT2_RESET;
break;
case GIRBIL_STATE_WAIT2_RESET:
/* Write control byte */
sirdev_raw_write(dev, &control, 1);
delay = 20;
state = GIRBIL_STATE_WAIT3_RESET;
break;
case GIRBIL_STATE_WAIT3_RESET:
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
dev->speed = 9600;
break;
default:
ERROR("%s(), undefined state %d\n", __FUNCTION__, state);
ret = -1;
break;
}
dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
}
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */
module_init(girbil_init);
module_exit(girbil_cleanup);
/*********************************************************************
*
* Filename: litelink.c
* Version: 1.1
* Description: Driver for the Parallax LiteLink dongle
* Status: Stable
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Fri May 7 12:50:33 1999
* Modified at: Fri Dec 17 09:14:23 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
********************************************************************/
/*
* Modified at: Thu Jan 15 2003
* Modified by: Eugene Crosser <crosser@average.org>
*
* Convert to "new" IRDA infrastructure for kernel 2.6
*/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
#define MAX_DELAY 10000 /* 1 ms */
static int litelink_open(struct sir_dev *dev);
static int litelink_close(struct sir_dev *dev);
static int litelink_change_speed(struct sir_dev *dev, unsigned speed);
static int litelink_reset(struct sir_dev *dev);
/* These are the baudrates supported - 9600 must be last one! */
static unsigned baud_rates[] = { 115200, 57600, 38400, 19200, 9600 };
static struct dongle_driver litelink = {
.owner = THIS_MODULE,
.driver_name = "Parallax LiteLink",
.type = IRDA_LITELINK_DONGLE,
.open = litelink_open,
.close = litelink_close,
.reset = litelink_reset,
.set_speed = litelink_change_speed,
};
int __init litelink_sir_init(void)
{
return irda_register_dongle(&litelink);
}
void __exit litelink_sir_cleanup(void)
{
irda_unregister_dongle(&litelink);
}
static int litelink_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power up dongle */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Set the speeds we can accept */
qos->baud_rate.bits &= IR_115200|IR_57600|IR_38400|IR_19200|IR_9600;
qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */
irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0;
}
static int litelink_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
/*
* Function litelink_change_speed (task)
*
* Change speed of the Litelink dongle. To cycle through the available
* baud rates, pulse RTS low for a few ms.
*/
static int litelink_change_speed(struct sir_dev *dev, unsigned speed)
{
int i;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* dongle already reset by irda-thread - current speed (dongle and
* port) is the default speed (115200 for litelink!)
*/
/* Cycle through avaiable baudrates until we reach the correct one */
for (i = 0; baud_rates[i] != speed; i++) {
/* end-of-list reached due to invalid speed request */
if (baud_rates[i] == 9600)
break;
/* Set DTR, clear RTS */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
/* Sleep a minimum of 15 us */
udelay(MIN_DELAY);
/* Set DTR, Set RTS */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Sleep a minimum of 15 us */
udelay(MIN_DELAY);
}
dev->speed = baud_rates[i];
/* invalid baudrate should not happen - but if, we return -EINVAL and
* the dongle configured for 9600 so the stack has a chance to recover
*/
return (dev->speed == speed) ? 0 : -EINVAL;
}
/*
* Function litelink_reset (task)
*
* Reset the Litelink type dongle.
*
*/
static int litelink_reset(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* probably the power-up can be dropped here, but with only
* 15 usec delay it's not worth the risk unless somebody with
* the hardware confirms it doesn't break anything...
*/
/* Power on dongle */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Sleep a minimum of 15 us */
udelay(MIN_DELAY);
/* Clear RTS to reset dongle */
sirdev_set_dtr_rts(dev, TRUE, FALSE);
/* Sleep a minimum of 15 us */
udelay(MIN_DELAY);
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Sleep a minimum of 15 us */
udelay(MIN_DELAY);
/* This dongles speed defaults to 115200 bps */
dev->speed = 115200;
return 0;
}
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Parallax Litelink dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-5"); /* IRDA_LITELINK_DONGLE */
/*
* Function init_module (void)
*
* Initialize Litelink module
*
*/
module_init(litelink_sir_init);
/*
* Function cleanup_module (void)
*
* Cleanup Litelink module
*
*/
module_exit(litelink_sir_cleanup);
/*********************************************************************
*
* Filename: ma600.c
* Version: 0.1
* Description: Implementation of the MA600 dongle
* Status: Experimental.
* Author: Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95
* Created at: Sat Jun 10 20:02:35 2000
* Modified at: Sat Aug 16 09:34:13 2003
* Modified by: Martin Diehl <mad@mdiehl.de> (modified for new sir_dev)
*
* Note: very thanks to Mr. Maru Wang <maru@mobileaction.com.tw> for providing
* information on the MA600 dongle
*
* Copyright (c) 2000 Leung, All Rights Reserved.
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
********************************************************************/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
static int ma600_open(struct sir_dev *);
static int ma600_close(struct sir_dev *);
static int ma600_change_speed(struct sir_dev *, unsigned);
static int ma600_reset(struct sir_dev *);
/* control byte for MA600 */
#define MA600_9600 0x00
#define MA600_19200 0x01
#define MA600_38400 0x02
#define MA600_57600 0x03
#define MA600_115200 0x04
#define MA600_DEV_ID1 0x05
#define MA600_DEV_ID2 0x06
#define MA600_2400 0x08
static struct dongle_driver ma600 = {
.owner = THIS_MODULE,
.driver_name = "MA600",
.type = IRDA_MA600_DONGLE,
.open = ma600_open,
.close = ma600_close,
.reset = ma600_reset,
.set_speed = ma600_change_speed,
};
int __init ma600_sir_init(void)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
return irda_register_dongle(&ma600);
}
void __exit ma600_sir_cleanup(void)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
irda_unregister_dongle(&ma600);
}
/*
Power on:
(0) Clear RTS and DTR for 1 second
(1) Set RTS and DTR for 1 second
(2) 9600 bps now
Note: assume RTS, DTR are clear before
*/
static int ma600_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Explicitly set the speeds we can accept */
qos->baud_rate.bits &= IR_2400|IR_9600|IR_19200|IR_38400
|IR_57600|IR_115200;
/* Hm, 0x01 means 10ms - for >= 1ms we would need 0x07 */
qos->min_turn_time.bits = 0x01; /* Needs at least 1 ms */
irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0;
}
static int ma600_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
static __u8 get_control_byte(__u32 speed)
{
__u8 byte;
switch (speed) {
default:
case 115200:
byte = MA600_115200;
break;
case 57600:
byte = MA600_57600;
break;
case 38400:
byte = MA600_38400;
break;
case 19200:
byte = MA600_19200;
break;
case 9600:
byte = MA600_9600;
break;
case 2400:
byte = MA600_2400;
break;
}
return byte;
}
/*
* Function ma600_change_speed (dev, speed)
*
* Set the speed for the MA600 type dongle.
*
* The dongle has already been reset to a known state (dongle default)
* We cycle through speeds by pulsing RTS low and then high.
*/
/*
* Function ma600_change_speed (dev, speed)
*
* Set the speed for the MA600 type dongle.
*
* Algorithm
* 1. Reset (already done by irda thread state machine)
* 2. clear RTS, set DTR and wait for 1ms
* 3. send Control Byte to the MA600 through TXD to set new baud rate
* wait until the stop bit of Control Byte is sent (for 9600 baud rate,
* it takes about 10 msec)
* 4. set RTS, set DTR (return to NORMAL Operation)
* 5. wait at least 10 ms, new setting (baud rate, etc) takes effect here
* after
*/
/* total delays are only about 20ms - let's just sleep for now to
* avoid the state machine complexity before we get things working
*/
static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
{
u8 byte;
IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __FUNCTION__,
speed, dev->speed);
/* dongle already reset, dongle and port at default speed (9600) */
/* Set RTS low for 1 ms */
sirdev_set_dtr_rts(dev, TRUE, FALSE);
mdelay(1);
/* Write control byte */
byte = get_control_byte(speed);
sirdev_raw_write(dev, &byte, sizeof(byte));
/* Wait at least 10ms: fake wait_until_sent - 10 bits at 9600 baud*/
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(15)); /* old ma600 uses 15ms */
#if 1
/* read-back of the control byte. ma600 is the first dongle driver
* which uses this so there might be some unidentified issues.
* Disable this in case of problems with readback.
*/
sirdev_raw_read(dev, &byte, sizeof(byte));
if (byte != get_control_byte(speed)) {
WARNING("%s(): bad control byte read-back %02x != %02x\n",
__FUNCTION__, (unsigned) byte,
(unsigned) get_control_byte(speed));
return -1;
}
else
IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__);
#endif
/* Set DTR, Set RTS */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Wait at least 10ms */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(10));
/* dongle is now switched to the new speed */
dev->speed = speed;
return 0;
}
/*
* Function ma600_reset (dev)
*
* This function resets the ma600 dongle.
*
* Algorithm:
* 0. DTR=0, RTS=1 and wait 10 ms
* 1. DTR=1, RTS=1 and wait 10 ms
* 2. 9600 bps now
*/
/* total delays are only about 20ms - let's just sleep for now to
* avoid the state machine complexity before we get things working
*/
int ma600_reset(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Reset the dongle : set DTR low for 10 ms */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(10));
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(10));
dev->speed = 9600; /* That's the dongle-default */
return 0;
}
MODULE_AUTHOR("Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95");
MODULE_DESCRIPTION("MA600 dongle driver version 0.1");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-11"); /* IRDA_MA600_DONGLE */
module_init(ma600_sir_init);
module_exit(ma600_sir_cleanup);
/*********************************************************************
*
*
* Filename: mcp2120.c
* Version: 1.0
* Description: Implementation for the MCP2120 (Microchip)
* Status: Experimental.
* Author: Felix Tang (tangf@eyetap.org)
* Created at: Sun Mar 31 19:32:12 EST 2002
* Based on code by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 2002 Felix Tang, All Rights Reserved.
*
* 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.
*
********************************************************************/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
static int mcp2120_reset(struct sir_dev *dev);
static int mcp2120_open(struct sir_dev *dev);
static int mcp2120_close(struct sir_dev *dev);
static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed);
#define MCP2120_9600 0x87
#define MCP2120_19200 0x8B
#define MCP2120_38400 0x85
#define MCP2120_57600 0x83
#define MCP2120_115200 0x81
#define MCP2120_COMMIT 0x11
static struct dongle_driver mcp2120 = {
.owner = THIS_MODULE,
.driver_name = "Microchip MCP2120",
.type = IRDA_MCP2120_DONGLE,
.open = mcp2120_open,
.close = mcp2120_close,
.reset = mcp2120_reset,
.set_speed = mcp2120_change_speed,
};
int __init mcp2120_init(void)
{
return irda_register_dongle(&mcp2120);
}
void __exit mcp2120_cleanup(void)
{
irda_unregister_dongle(&mcp2120);
}
static int mcp2120_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* seems no explicit power-on required here and reset switching it on anyway */
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits = 0x01;
irda_qos_bits_to_value(qos);
return 0;
}
static int mcp2120_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */
/* reset and inhibit mcp2120 */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
// sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
/*
* Function mcp2120_change_speed (dev, speed)
*
* Set the speed for the MCP2120.
*
*/
#define MCP2120_STATE_WAIT_SPEED (SIRDEV_STATE_DONGLE_SPEED+1)
static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed)
{
unsigned state = dev->fsm.substate;
unsigned delay = 0;
u8 control[2];
static int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
switch (state) {
case SIRDEV_STATE_DONGLE_SPEED:
/* Set DTR to enter command mode */
sirdev_set_dtr_rts(dev, TRUE, FALSE);
udelay(500);
ret = 0;
switch (speed) {
default:
speed = 9600;
ret = -EINVAL;
/* fall through */
case 9600:
control[0] = MCP2120_9600;
//printk("mcp2120 9600\n");
break;
case 19200:
control[0] = MCP2120_19200;
//printk("mcp2120 19200\n");
break;
case 34800:
control[0] = MCP2120_38400;
//printk("mcp2120 38400\n");
break;
case 57600:
control[0] = MCP2120_57600;
//printk("mcp2120 57600\n");
break;
case 115200:
control[0] = MCP2120_115200;
//printk("mcp2120 115200\n");
break;
}
control[1] = MCP2120_COMMIT;
/* Write control bytes */
sirdev_raw_write(dev, control, 2);
dev->speed = speed;
state = MCP2120_STATE_WAIT_SPEED;
delay = 100;
//printk("mcp2120_change_speed: dongle_speed\n");
break;
case MCP2120_STATE_WAIT_SPEED:
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
//printk("mcp2120_change_speed: mcp_wait\n");
break;
default:
ERROR("%s(), undefine state %d\n", __FUNCTION__, state);
ret = -EINVAL;
break;
}
dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
}
/*
* Function mcp2120_reset (driver)
*
* This function resets the mcp2120 dongle.
*
* Info: -set RTS to reset mcp2120
* -set DTR to set mcp2120 software command mode
* -mcp2120 defaults to 9600 baud after reset
*
* Algorithm:
* 0. Set RTS to reset mcp2120.
* 1. Clear RTS and wait for device reset timer of 30 ms (max).
*
*/
#define MCP2120_STATE_WAIT1_RESET (SIRDEV_STATE_DONGLE_RESET+1)
#define MCP2120_STATE_WAIT2_RESET (SIRDEV_STATE_DONGLE_RESET+2)
static int mcp2120_reset(struct sir_dev *dev)
{
unsigned state = dev->fsm.substate;
unsigned delay = 0;
int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
switch (state) {
case SIRDEV_STATE_DONGLE_RESET:
//printk("mcp2120_reset: dongle_reset\n");
/* Reset dongle by setting RTS*/
sirdev_set_dtr_rts(dev, TRUE, TRUE);
state = MCP2120_STATE_WAIT1_RESET;
delay = 50;
break;
case MCP2120_STATE_WAIT1_RESET:
//printk("mcp2120_reset: mcp2120_wait1\n");
/* clear RTS and wait for at least 30 ms. */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
state = MCP2120_STATE_WAIT2_RESET;
delay = 50;
break;
case MCP2120_STATE_WAIT2_RESET:
//printk("mcp2120_reset mcp2120_wait2\n");
/* Go back to normal mode */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
break;
default:
ERROR("%s(), undefined state %d\n", __FUNCTION__, state);
ret = -EINVAL;
break;
}
dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
}
MODULE_AUTHOR("Felix Tang <tangf@eyetap.org>");
MODULE_DESCRIPTION("Microchip MCP2120");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */
module_init(mcp2120_init);
module_exit(mcp2120_cleanup);
/*********************************************************************
*
* Filename: old_belkin.c
* Version: 1.1
* Description: Driver for the Belkin (old) SmartBeam dongle
* Status: Experimental...
* Author: Jean Tourrilhes <jt@hpl.hp.com>
* Created at: 22/11/99
* Modified at: Fri Dec 17 09:13:32 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Jean Tourrilhes, All Rights Reserved.
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
********************************************************************/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <net/irda/irda.h>
// #include <net/irda/irda_device.h>
#include "sir-dev.h"
/*
* Belkin is selling a dongle called the SmartBeam.
* In fact, there is two hardware version of this dongle, of course with
* the same name and looking the exactly same (grrr...).
* I guess that I've got the old one, because inside I don't have
* a jumper for IrDA/ASK...
*
* As far as I can make it from info on their web site, the old dongle
* support only 9600 b/s, which make our life much simpler as far as
* the driver is concerned, but you might not like it very much ;-)
* The new SmartBeam does 115 kb/s, and I've not tested it...
*
* Belkin claim that the correct driver for the old dongle (in Windows)
* is the generic Parallax 9500a driver, but the Linux LiteLink driver
* fails for me (probably because Linux-IrDA doesn't rate fallback),
* so I created this really dumb driver...
*
* In fact, this driver doesn't do much. The only thing it does is to
* prevent Linux-IrDA to use any other speed than 9600 b/s ;-) This
* driver is called "old_belkin" so that when the new SmartBeam is supported
* its driver can be called "belkin" instead of "new_belkin".
*
* Note : this driver was written without any info/help from Belkin,
* so a lot of info here might be totally wrong. Blame me ;-)
*/
static int old_belkin_open(struct sir_dev *dev);
static int old_belkin_close(struct sir_dev *dev);
static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed);
static int old_belkin_reset(struct sir_dev *dev);
static struct dongle_driver old_belkin = {
.owner = THIS_MODULE,
.driver_name = "Old Belkin SmartBeam",
.type = IRDA_OLD_BELKIN_DONGLE,
.open = old_belkin_open,
.close = old_belkin_close,
.reset = old_belkin_reset,
.set_speed = old_belkin_change_speed,
};
int __init old_belkin_init(void)
{
return irda_register_dongle(&old_belkin);
}
void __exit old_belkin_cleanup(void)
{
irda_unregister_dongle(&old_belkin);
}
static int old_belkin_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power on dongle */
sirdev_set_dtr_rts(dev, TRUE, TRUE);
/* Not too fast, please... */
qos->baud_rate.bits &= IR_9600;
/* Needs at least 10 ms (totally wild guess, can do probably better) */
qos->min_turn_time.bits = 0x01;
irda_qos_bits_to_value(qos);
/* irda thread waits 50 msec for power settling */
return 0;
}
static int old_belkin_close(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */
sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0;
}
/*
* Function old_belkin_change_speed (task)
*
* With only one speed available, not much to do...
*/
static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
dev->speed = 9600;
return (speed==dev->speed) ? 0 : -EINVAL;
}
/*
* Function old_belkin_reset (task)
*
* Reset the Old-Belkin type dongle.
*
*/
static int old_belkin_reset(struct sir_dev *dev)
{
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* This dongles speed "defaults" to 9600 bps ;-) */
dev->speed = 9600;
return 0;
}
MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */
module_init(old_belkin_init);
module_exit(old_belkin_cleanup);
...@@ -121,15 +121,17 @@ extern int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type); ...@@ -121,15 +121,17 @@ extern int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type);
extern void sirdev_write_complete(struct sir_dev *dev); extern void sirdev_write_complete(struct sir_dev *dev);
extern int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count); extern int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count);
/* low level helpers for SIR device/dongle setup */
extern int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len);
extern int sirdev_raw_read(struct sir_dev *dev, char *buf, int len);
extern int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts);
/* not exported */ /* not exported */
extern int sirdev_get_dongle(struct sir_dev *self, IRDA_DONGLE type); extern int sirdev_get_dongle(struct sir_dev *self, IRDA_DONGLE type);
extern int sirdev_put_dongle(struct sir_dev *self); extern int sirdev_put_dongle(struct sir_dev *self);
extern int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len);
extern int sirdev_raw_read(struct sir_dev *dev, char *buf, int len);
extern void sirdev_enable_rx(struct sir_dev *dev); extern void sirdev_enable_rx(struct sir_dev *dev);
extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param); extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param);
extern int __init irda_thread_create(void); extern int __init irda_thread_create(void);
extern void __exit irda_thread_join(void); extern void __exit irda_thread_join(void);
...@@ -195,10 +197,6 @@ struct sir_dev { ...@@ -195,10 +197,6 @@ struct sir_dev {
const struct sir_driver * drv; const struct sir_driver * drv;
void *priv; void *priv;
/* dongle callbacks to the SIR device */
int (*read)(struct sir_dev *, char *buf, int len);
int (*write)(struct sir_dev *, const char *buf, int len);
int (*set_dtr_rts)(struct sir_dev *, int dtr, int rts);
}; };
#endif /* IRDA_SIR_H */ #endif /* IRDA_SIR_H */
...@@ -37,6 +37,10 @@ EXPORT_SYMBOL(sirdev_set_dongle); ...@@ -37,6 +37,10 @@ EXPORT_SYMBOL(sirdev_set_dongle);
EXPORT_SYMBOL(sirdev_write_complete); EXPORT_SYMBOL(sirdev_write_complete);
EXPORT_SYMBOL(sirdev_receive); EXPORT_SYMBOL(sirdev_receive);
EXPORT_SYMBOL(sirdev_raw_write);
EXPORT_SYMBOL(sirdev_raw_read);
EXPORT_SYMBOL(sirdev_set_dtr_rts);
static int __init sir_core_init(void) static int __init sir_core_init(void)
{ {
return irda_thread_create(); return irda_thread_create();
......
...@@ -117,6 +117,14 @@ int sirdev_raw_read(struct sir_dev *dev, char *buf, int len) ...@@ -117,6 +117,14 @@ int sirdev_raw_read(struct sir_dev *dev, char *buf, int len)
return count; return count;
} }
int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
{
int ret = -ENXIO;
if (dev->drv->set_dtr_rts != 0)
ret = dev->drv->set_dtr_rts(dev, dtr, rts);
return ret;
}
/**********************************************************************/ /**********************************************************************/
/* called from client driver - likely with bh-context - to indicate /* called from client driver - likely with bh-context - to indicate
......
...@@ -102,12 +102,6 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type) ...@@ -102,12 +102,6 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
err = -ESTALE; err = -ESTALE;
goto out_unlock; /* rmmod already pending */ goto out_unlock; /* rmmod already pending */
} }
/* Initialize dongle driver callbacks */
dev->read = sirdev_raw_read;
dev->write = sirdev_raw_write;
dev->set_dtr_rts = dev->drv->set_dtr_rts;
dev->dongle_drv = drv; dev->dongle_drv = drv;
if (!drv->open || (err=drv->open(dev))!=0) if (!drv->open || (err=drv->open(dev))!=0)
......
...@@ -311,15 +311,9 @@ static void irda_config_fsm(void *data) ...@@ -311,15 +311,9 @@ static void irda_config_fsm(void *data)
break; break;
case SIRDEV_STATE_SET_DTR_RTS: case SIRDEV_STATE_SET_DTR_RTS:
if (dev->drv->set_dtr_rts) { ret = sirdev_set_dtr_rts(dev,
int dtr, rts; (fsm->param&0x02) ? TRUE : FALSE,
(fsm->param&0x01) ? TRUE : FALSE);
dtr = (fsm->param&0x02) ? TRUE : FALSE;
rts = (fsm->param&0x01) ? TRUE : FALSE;
ret = dev->drv->set_dtr_rts(dev,dtr,rts);
}
else
ret = -EINVAL;
next_state = SIRDEV_STATE_DONE; next_state = SIRDEV_STATE_DONE;
break; break;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
MODULE_PARM(tekram_delay, "i"); MODULE_PARM(tekram_delay, "i");
MODULE_PARM_DESC(tekram_delay, "tekram dongle write complete delay"); MODULE_PARM_DESC(tekram_delay, "tekram dongle write complete delay");
static int tekram_delay = 50; /* default is 50 ms */ static int tekram_delay = 150; /* default is 150 ms */
static int tekram_open(struct sir_dev *); static int tekram_open(struct sir_dev *);
static int tekram_close(struct sir_dev *); static int tekram_close(struct sir_dev *);
...@@ -61,8 +61,10 @@ static struct dongle_driver tekram = { ...@@ -61,8 +61,10 @@ static struct dongle_driver tekram = {
int __init tekram_sir_init(void) int __init tekram_sir_init(void)
{ {
if (tekram_delay < 1 || tekram_delay>500) if (tekram_delay < 1 || tekram_delay > 500)
tekram_delay = 200; tekram_delay = 200;
IRDA_DEBUG(1, "%s - using %d ms delay\n",
tekram.driver_name, tekram_delay);
return irda_register_dongle(&tekram); return irda_register_dongle(&tekram);
} }
...@@ -77,7 +79,8 @@ static int tekram_open(struct sir_dev *dev) ...@@ -77,7 +79,8 @@ static int tekram_open(struct sir_dev *dev)
IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
dev->set_dtr_rts(dev, TRUE, TRUE); sirdev_set_dtr_rts(dev, TRUE, TRUE);
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
irda_qos_bits_to_value(qos); irda_qos_bits_to_value(qos);
...@@ -92,7 +95,7 @@ static int tekram_close(struct sir_dev *dev) ...@@ -92,7 +95,7 @@ static int tekram_close(struct sir_dev *dev)
IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
/* Power off dongle */ /* Power off dongle */
dev->set_dtr_rts(dev, FALSE, FALSE); sirdev_set_dtr_rts(dev, FALSE, FALSE);
return 0; return 0;
} }
...@@ -122,19 +125,20 @@ static int tekram_close(struct sir_dev *dev) ...@@ -122,19 +125,20 @@ static int tekram_close(struct sir_dev *dev)
static int tekram_change_speed(struct sir_dev *dev, unsigned speed) static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
{ {
unsigned state = dev->fsm.substate;
unsigned delay = 0; unsigned delay = 0;
unsigned next_state = dev->fsm.substate;
u8 byte; u8 byte;
static int ret = 0;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
switch(dev->fsm.substate) { switch(state) {
case SIRDEV_STATE_DONGLE_SPEED: case SIRDEV_STATE_DONGLE_SPEED:
switch (speed) { switch (speed) {
default: default:
speed = 9600; speed = 9600;
ret = -EINVAL;
/* fall thru */ /* fall thru */
case 9600: case 9600:
byte = TEKRAM_PW|TEKRAM_9600; byte = TEKRAM_PW|TEKRAM_9600;
...@@ -154,36 +158,34 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -154,36 +158,34 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
} }
/* Set DTR, Clear RTS */ /* Set DTR, Clear RTS */
dev->set_dtr_rts(dev, TRUE, FALSE); sirdev_set_dtr_rts(dev, TRUE, FALSE);
/* Wait at least 7us */ /* Wait at least 7us */
udelay(14); udelay(14);
/* Write control byte */ /* Write control byte */
dev->write(dev, &byte, 1); sirdev_raw_write(dev, &byte, 1);
dev->speed = speed; dev->speed = speed;
next_state = TEKRAM_STATE_WAIT_SPEED; state = TEKRAM_STATE_WAIT_SPEED;
delay = tekram_delay; /* default: 50 ms */ delay = tekram_delay;
break; break;
case TEKRAM_STATE_WAIT_SPEED: case TEKRAM_STATE_WAIT_SPEED:
/* Set DTR, Set RTS */ /* Set DTR, Set RTS */
dev->set_dtr_rts(dev, TRUE, TRUE); sirdev_set_dtr_rts(dev, TRUE, TRUE);
udelay(50); udelay(50);
break;
return 0;
default: default:
ERROR("%s - undefined state\n", __FUNCTION__); ERROR("%s - undefined state %d\n", __FUNCTION__, state);
return -EINVAL; ret = -EINVAL;
break;
} }
dev->fsm.substate = next_state; dev->fsm.substate = state;
return (delay > 0) ? delay : ret;
return delay;
} }
/* /*
...@@ -200,43 +202,26 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -200,43 +202,26 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
* operation * operation
*/ */
#define TEKRAM_STATE_WAIT_RESET (SIRDEV_STATE_DONGLE_RESET + 1)
static int tekram_reset(struct sir_dev *dev) static int tekram_reset(struct sir_dev *dev)
{ {
unsigned delay = 0;
unsigned next_state = dev->fsm.substate;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
switch(dev->fsm.substate) { /* Clear DTR, Set RTS */
sirdev_set_dtr_rts(dev, FALSE, TRUE);
case SIRDEV_STATE_DONGLE_RESET:
/* Clear DTR, Set RTS */
dev->set_dtr_rts(dev, FALSE, TRUE);
next_state = TEKRAM_STATE_WAIT_RESET; /* Should sleep 1 ms */
delay = 1; /* Should sleep 1 ms */ set_current_state(TASK_UNINTERRUPTIBLE);
break; schedule_timeout(MSECS_TO_JIFFIES(1));
case TEKRAM_STATE_WAIT_RESET: /* Set DTR, Set RTS */
/* Set DTR, Set RTS */ sirdev_set_dtr_rts(dev, TRUE, TRUE);
dev->set_dtr_rts(dev, TRUE, TRUE);
/* Wait at least 50 us */ /* Wait at least 50 us */
udelay(75); udelay(75);
return 0; dev->speed = 9600;
default: return 0;
ERROR("%s - undefined state\n", __FUNCTION__);
return -EINVAL;
}
dev->fsm.substate = next_state;
return delay;
} }
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment