From: lyx Date: Thu, 29 Sep 2011 02:58:15 +0000 (+0800) Subject: newton IrDA : improve IrDA bu92747 sending process X-Git-Tag: firefly_0821_release~9766^2~43 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bb0d359f67ac0d12c946c15c8f24290143162146;p=firefly-linux-kernel-4.4.55.git newton IrDA : improve IrDA bu92747 sending process 1.优化IrDA发送流程 2.解决在通常送信模式下,当irda传输的文件大小大于485520Byte的时候,传输失败的问题。 --- diff --git a/drivers/net/irda/bu92725guw.c b/drivers/net/irda/bu92725guw.c index e46c23b6c8b1..9578707482ae 100755 --- a/drivers/net/irda/bu92725guw.c +++ b/drivers/net/irda/bu92725guw.c @@ -200,8 +200,8 @@ int irda_hw_set_speed(u32 speed) if (mode == BU92725GUW_MIR) curTrans_way = BU92725GUW_MIR_SEND; else if (mode == BU92725GUW_FIR) - //curTrans_way = BU92725GUW_MULTI_SEND; - curTrans_way = BU92725GUW_FIR_SEND; + curTrans_way = BU92725GUW_MULTI_SEND; + //curTrans_way = BU92725GUW_FIR_SEND; break; case BU92725GUW_MIR_REV: if (mode == BU92725GUW_SIR) @@ -215,8 +215,8 @@ int irda_hw_set_speed(u32 speed) if (mode == BU92725GUW_SIR) curTrans_way = BU92725GUW_SEND; else if (mode == BU92725GUW_FIR) - //curTrans_way = BU92725GUW_MULTI_SEND; - curTrans_way = BU92725GUW_FIR_SEND; + curTrans_way = BU92725GUW_MULTI_SEND; + //curTrans_way = BU92725GUW_FIR_SEND; break; case BU92725GUW_FIR_REV: case BU92725GUW_AUTO_MULTI_REV: @@ -260,8 +260,8 @@ int irda_hw_tx_enable_irq(enum eTrans_Mode mode) else if (mode == BU92725GUW_MIR) BU92725GUW_set_trans_way(BU92725GUW_MIR_SEND); else - //BU92725GUW_set_trans_way(BU92725GUW_MULTI_SEND); - BU92725GUW_set_trans_way(BU92725GUW_FIR_SEND); + BU92725GUW_set_trans_way(BU92725GUW_MULTI_SEND); + //BU92725GUW_set_trans_way(BU92725GUW_FIR_SEND); //BU92725GUW_clr_fifo(); return 0; @@ -351,7 +351,13 @@ void BU92725GUW_set_trans_way(u32 way) curTrans_way = way; /* set bu92725guw registers */ - internal_set(1); + /* [Modify] AIC 2011/09/27 + * MS_EN(TRCR5)¤Ë¤è¤ëͨÐÅ¥â©`¥ÉÇÐÌæ„Ó×÷¤òÐФï¤Ê¤¤¤è¤¦¤ËÐÞÕý¤·¤Þ¤·¤¿¡£ + * + * internal_set(1); + */ + internal_set(0); + /* [Modify] AIC 2011/09/27 */ } /* diff --git a/drivers/net/irda/ir_serial.c b/drivers/net/irda/ir_serial.c index 1add7b6d2d92..ec601f680603 100755 --- a/drivers/net/irda/ir_serial.c +++ b/drivers/net/irda/ir_serial.c @@ -183,6 +183,7 @@ static int bu92747_irda_do_tx(struct bu92747_port *s) //int i; struct circ_buf *xmit = &s->port.state->xmit; int len = uart_circ_chars_pending(xmit); + int len1, len2; IRDA_DBG_SENT("line %d, enter %s, sending %d data\n", __LINE__, __FUNCTION__, len); if (IS_FIR(s)) { @@ -196,7 +197,21 @@ static int bu92747_irda_do_tx(struct bu92747_port *s) s->tx_empty = 0; } - BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0); + /* [Modify] AIC 2011/09/27 + * ËÍÐťХåե¡¤«¤é¥Ç©`¥¿¤òÈ¡¤ê³ö¤¹·½·¨¤Ë†–î}¤¬¤¢¤ê¡¢Ò»²¿¤Î + * ¥Ç©`¥¿¤¬Õý¤·¤¯Ëͤì¤Ê¤¤¤³¤È¤¬¤¢¤ë¤¿¤á¤Ë¡¢ËÍÐťǩ`¥¿¤Î + * È¡µÃ·½·¨¤òÐÞÕý¤·¤Þ¤·¤¿¡£ + * + * BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0); + */ + if ( (xmit->tail + len) > UART_XMIT_SIZE ) { + len1 = UART_XMIT_SIZE - xmit->tail; + len2 = len - len1; + BU92725GUW_send_data(xmit->buf+xmit->tail, len1, xmit->buf, len2); + } else { + BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0); + } + /* [Modify-end] AIC 2011/09/27 */ s->port.icount.tx += len; xmit->tail = (xmit->tail + len) & (UART_XMIT_SIZE - 1); @@ -278,11 +293,25 @@ static irqreturn_t bu92747_irda_irq(int irqno, void *dev_id) } } + /* [Modify] AIC 2011/09/27 + * WRE_EI(EIR11)¸î¤êÞz¤ß¤Î•rµã¤Ç¡¢ËÍÐÅ¥â©`¥É¤«¤éÊÜÐÅ¥â©`¥É¤Ø + * ÇФêÌæ¤¨¤Æ¤·¤Þ¤¦¤È¡¢ËÍÐťǩ`¥¿¤Î×îáá¤Î²¿·Ö¤¬ËÍÐŤµ¤ì¤Ê¤¤¤³¤È¤¬ + * ¤¢¤ë¤¿¤á¡¢ËÍÐÅÍêÁ˸î¤êÞz¤ß(TXE_EI:EIR3)¤ò´ý¤Ä¤è¤¦¤ËÐÞÕý¤·¤Þ¤·¤¿¡£ + * + * if (irq_src & (FRM_EVT_TX_TXE | FRM_EVT_TX_WRE)) { + * s->tx_empty = 1; + * irda_hw_set_moderx(); + * } + */ if (irq_src & (FRM_EVT_TX_TXE | FRM_EVT_TX_WRE)) { + /* ËÍÐŤ¬¾A¤¯ˆöºÏ¤Ï¡¢¤³¤³¤Ç´Î¤Î¥Ç©`¥¿¤¬ËÍÐÅ¿ÉÄܤȤʤë */ s->tx_empty = 1; - irda_hw_set_moderx(); + if (irq_src & FRM_EVT_TX_TXE) { + /* ÍêÈ«¤ËËÍÐÅÍêÁˤȤʤ俈öºÏ¡¢ÊÜÐÅ¥â©`¥É¤ØÇФêÌæ¤¨¤ë */ + irda_hw_set_moderx(); + } } - + /* [Modify-end] AIC 2011/09/27 */ #if 0 /* error */ if (irq_src & REG_INT_TO) {