aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/synclink_gt.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index b4f1a5a435aa..6f93a0149fbf 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -2515,7 +2515,8 @@ static int set_txidle(struct slgt_info *info, int idle_mode)
2515 DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); 2515 DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode));
2516 spin_lock_irqsave(&info->lock,flags); 2516 spin_lock_irqsave(&info->lock,flags);
2517 info->idle_mode = idle_mode; 2517 info->idle_mode = idle_mode;
2518 tx_set_idle(info); 2518 if (info->params.mode != MGSL_MODE_ASYNC)
2519 tx_set_idle(info);
2519 spin_unlock_irqrestore(&info->lock,flags); 2520 spin_unlock_irqrestore(&info->lock,flags);
2520 return 0; 2521 return 0;
2521} 2522}
@@ -3940,8 +3941,6 @@ static void async_mode(struct slgt_info *info)
3940 3941
3941 msc_set_vcr(info); 3942 msc_set_vcr(info);
3942 3943
3943 tx_set_idle(info);
3944
3945 /* SCR (serial control) 3944 /* SCR (serial control)
3946 * 3945 *
3947 * 15 1=tx req on FIFO half empty 3946 * 15 1=tx req on FIFO half empty
@@ -4175,17 +4174,38 @@ static void hdlc_mode(struct slgt_info *info)
4175 */ 4174 */
4176static void tx_set_idle(struct slgt_info *info) 4175static void tx_set_idle(struct slgt_info *info)
4177{ 4176{
4178 unsigned char val = 0xff; 4177 unsigned char val;
4178 unsigned short tcr;
4179 4179
4180 switch(info->idle_mode) 4180 /* if preamble enabled (tcr[6] == 1) then tx idle size = 8 bits
4181 { 4181 * else tcr[5:4] = tx idle size: 00 = 8 bits, 01 = 16 bits
4182 case HDLC_TXIDLE_FLAGS: val = 0x7e; break; 4182 */
4183 case HDLC_TXIDLE_ALT_ZEROS_ONES: val = 0xaa; break; 4183 tcr = rd_reg16(info, TCR);
4184 case HDLC_TXIDLE_ZEROS: val = 0x00; break; 4184 if (info->idle_mode & HDLC_TXIDLE_CUSTOM_16) {
4185 case HDLC_TXIDLE_ONES: val = 0xff; break; 4185 /* disable preamble, set idle size to 16 bits */
4186 case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break; 4186 tcr = (tcr & ~(BIT6 + BIT5)) | BIT4;
4187 case HDLC_TXIDLE_SPACE: val = 0x00; break; 4187 /* MSB of 16 bit idle specified in tx preamble register (TPR) */
4188 case HDLC_TXIDLE_MARK: val = 0xff; break; 4188 wr_reg8(info, TPR, (unsigned char)((info->idle_mode >> 8) & 0xff));
4189 } else if (!(tcr & BIT6)) {
4190 /* preamble is disabled, set idle size to 8 bits */
4191 tcr &= ~(BIT5 + BIT4);
4192 }
4193 wr_reg16(info, TCR, tcr);
4194
4195 if (info->idle_mode & (HDLC_TXIDLE_CUSTOM_8 | HDLC_TXIDLE_CUSTOM_16)) {
4196 /* LSB of custom tx idle specified in tx idle register */
4197 val = (unsigned char)(info->idle_mode & 0xff);
4198 } else {
4199 /* standard 8 bit idle patterns */
4200 switch(info->idle_mode)
4201 {
4202 case HDLC_TXIDLE_FLAGS: val = 0x7e; break;
4203 case HDLC_TXIDLE_ALT_ZEROS_ONES:
4204 case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break;
4205 case HDLC_TXIDLE_ZEROS:
4206 case HDLC_TXIDLE_SPACE: val = 0x00; break;
4207 default: val = 0xff;
4208 }
4189 } 4209 }
4190 4210
4191 wr_reg8(info, TIR, val); 4211 wr_reg8(info, TIR, val);