summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2010-12-02 12:07:58 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2010-12-02 12:07:58 +0100
commite79ecf45114ac7ddee989dac439867a3d3780655 (patch)
treeb6bdbb5b9dfc2f0de8b7ab12715e36f835724b35
parentbb72e811ab26b8d98fc59515616e7e82ec206e24 (diff)
if it works, do break it
-rw-r--r--xhfc/xhfc.c70
-rw-r--r--xhfc/xhfc.h8
-rw-r--r--xhfc/xhfc_st_state.c6
3 files changed, 56 insertions, 28 deletions
diff --git a/xhfc/xhfc.c b/xhfc/xhfc.c
index 58e4b6d..7d9b2ed 100644
--- a/xhfc/xhfc.c
+++ b/xhfc/xhfc.c
@@ -547,7 +547,6 @@ void xhfc_hdlc_hard_xmit(struct dahdi_chan *chan)
irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs)
{
- /* (void) ptregs; */
struct xhfc_pi *pi = dev_id;
struct xhfc *xhfc;
@@ -555,6 +554,9 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs)
int i;
u8 r_su_irq;
u8 misc_irq;
+ u32 fifo_irq = 0;
+
+ (void) ptregs;
xhfc = &pi->xhfc;
@@ -571,13 +573,29 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs)
if (misc_irq & M_TI_IRQMSK)
xhfc->ticks++;
+ /*
+ for(i = 0; i < SPANS_PER_CHIP; i++)
+ fifo_irq |= (read_xhfc(xhfc, R_FIFO_BL0_IRQ + i) |
+ read_xhfc(xhfc, R_FILL_BL0 + i)) << (i * 8);
+ if(DBG_HDLC && fifo_irq)
+ printk(KERN_INFO DRIVER_NAME ": fifo_irq=0x%08x\n", fifo_irq);
+ */
+
+
for (i = 0; i < SPANS_PER_CHIP; i++) {
struct xhfc_span* s = &xhfc->spans[i];
if ((s->span.flags & DAHDI_FLAG_RUNNING) && s->sigchan) {
- /* No need to loop here, no need to rx/tx
- * more than one HDLC frame per millisecond. */
- hdlc_rx_frame(s);
+
+ /* No need to loop, makes no sense to receive
+ * more than one HDLC frame per second.
+ */
+ /* d chan number = i * 4 + 2
+ * rx + tx => * 2
+ * rx => + 1
+ */
+ //if (fifo_irq & (1 << ((i * 4 + 2) * 2 + 1)))
+ hdlc_rx_frame(s);
if (atomic_read(&s->hdlc_pending))
hdlc_tx_frame(s);
#ifdef AUDIO
@@ -643,6 +661,7 @@ static void disable_interrupts(struct xhfc * xhfc)
/******************************************/
static void enable_interrupts(struct xhfc * xhfc)
{
+ u8 r_irq_ctrl = 0;
printk(KERN_INFO "%s %s\n", xhfc->name, __func__);
set_mb(xhfc->running, 1);
@@ -660,7 +679,8 @@ static void enable_interrupts(struct xhfc * xhfc)
read_xhfc(xhfc, R_FIFO_BL3_IRQ);
/* enable global interrupts */
- write_xhfc(xhfc, R_IRQ_CTRL, M_GLOB_IRQ_EN);
+ SET_V_GLOB_IRQ_EN(r_irq_ctrl, 1);
+ write_xhfc(xhfc, R_IRQ_CTRL, r_irq_ctrl);
}
@@ -711,6 +731,7 @@ void configure_port(int port, int nt, int lineterm)
void xhfc_init_and_configure(struct xhfc* x)
{
+ u8 r_fifo_thres = 0;
/* In DAHDI's driver's this part is "stage 1" */
xhfc_reset(x);
@@ -722,6 +743,10 @@ void xhfc_init_and_configure(struct xhfc* x)
/* Now we need to setup the flow controller and stuff */
xhfc_config_data_flow(x);
+
+ SET_V_THRES_RX(r_fifo_thres, 1);
+ SET_V_THRES_TX(r_fifo_thres, 1);
+ write_xhfc(x, R_FIFO_THRES, r_fifo_thres);
}
static void xhfc_span_set_ntte(struct xhfc_span* s, int ntte)
@@ -772,7 +797,9 @@ int xhfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
start_state_machine(xhfc_span);
- activate_request(xhfc_span); //XXX should be done in xhfc_open
+ activate_request(xhfc_span); /* TODO: for powersaving reasons, may be
+ useful for NT to move the activation/
+ deactivation to open/close. */
return 0;
}
@@ -829,18 +856,33 @@ static int xhfc_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long d
return -ENOTTY;
}
-/************************************************************************
- * Responsible for initializing the xhfc_span and dahdi_span structures *
- ************************************************************************/
+static int xhfc_span_startup(struct dahdi_span* s)
+{
+ struct xhfc_span *xhfc_span = container_of(s, struct xhfc_span, span);
+ activate_request(xhfc_span);
+ return 0;
+}
+
+static int xhfc_span_shutdown(struct dahdi_span* s)
+{
+ struct xhfc_span *xhfc_span = container_of(s, struct xhfc_span, span);
+ deactivate_request(xhfc_span);
+ return 0;
+}
+
static const struct dahdi_span_ops xhfc_span_ops = {
.owner = THIS_MODULE,
.spanconfig = xhfc_spanconfig,
.chanconfig = xhfc_chanconfig,
+ .startup = xhfc_span_startup,
+ .shutdown = xhfc_span_shutdown,
.ioctl = xhfc_ioctl,
.hdlc_hard_xmit = xhfc_hdlc_hard_xmit,
};
-
+/************************************************************************
+ * Responsible for initializing the xhfc_span and dahdi_span structures *
+ ************************************************************************/
void init_spans(struct xhfc* x)
{
int i, j;
@@ -925,7 +967,7 @@ static struct pci_driver xhfc_driver = {
.id_table = tlp_leb_pci_tbl,
.probe = xhfc_init_one,
.remove = __devexit_p(xhfc_remove_one),
- .shutdown = xhfc_shutdown,
+// .shutdown = xhfc_shutdown,
};
/* pci.txt: called from process context */
@@ -1141,12 +1183,6 @@ void __devexit xhfc_remove_one(struct pci_dev *pdev)
printk(KERN_DEBUG "%s: bye-bye.\n", __func__);
}
-void xhfc_shutdown(struct pci_dev *pdev)
-{
- if (DBG)
- printk(KERN_DEBUG "%s: Au revoir.\n", __func__);
-}
-
/***************/
/* Module init */
/***************/
diff --git a/xhfc/xhfc.h b/xhfc/xhfc.h
index 396c57a..c12f985 100644
--- a/xhfc/xhfc.h
+++ b/xhfc/xhfc.h
@@ -132,16 +132,12 @@ struct xhfc_span {
struct xhfc {
char *name;
- __u8 chipidx; /* index in pi->xhfcs[NUM_XHFCS] */
struct xhfc_pi *pi; /* backpointer to xhfc_pi */
struct xhfc_span spans[SPANS_PER_CHIP];
- /* from DAHDI */
- int running;
- unsigned long ticks;
- int setsyncspan; /* Span reported from HFC for sync on this card */
- int reportedsyncspan; /* Span reported from HFC for sync on this card */
+ int running;
+ unsigned long ticks;
};
struct xhfc_pi {
diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c
index 8c04784..6f15e00 100644
--- a/xhfc/xhfc_st_state.c
+++ b/xhfc/xhfc_st_state.c
@@ -35,8 +35,6 @@ static void handle_state_change_te(struct xhfc_span* s);
static void allow_G2_G3_transition(struct xhfc_span* s);
-static void set_st_state(struct xhfc_span* s, int state);
-
static void print_state(struct xhfc_span* s);
void start_state_machine(struct xhfc_span* s)
@@ -254,12 +252,10 @@ static void activation_timer_expiry(struct xhfc_span* s)
*/
deactivate_request(s);
- // set_st_state(s, G4);
} else if(t3_expiry) {
deactivate_request(s);
- // set_st_state(s, F3);
}
}
@@ -274,7 +270,7 @@ static void allow_G2_G3_transition(struct xhfc_span* s)
write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta);
/* The bit is automatically cleared on G2->G3. G2->G4 is always
- * triggered by using set_st_state which clears this bit. Therefore
+ * triggered by using activate_request which clears this bit. Therefore
* this bit is always cleared correctly when exiting G2. */
}